Challenge

Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol

int analogPin = 0;

int raw = 0;

int Vin = 5;

float Vout = 0;

float R1 = 1000;

float R2 = 0;

float buffer = 0;

void setup(){

Serial.begin(9600);

}

void loop(){

raw = analogRead(analogPin);

if(raw){

buffer = raw * Vin;

Vout = (buffer)/1024.0;

buffer = (Vin/Vout) - 1;

R2= R1 * buffer;

Serial.print("Vout: ");

Serial.println(Vout);

Serial.print("R2: ");

Serial.println(R2);

delay(1000);

}

}

Output

Vout 5.00

R2 0.98

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.