Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h> //
- LiquidCrystal lcd( 4, 5, 6, 7,8 ,9 );
- float input_volt = 0.0;
- float temp=0.0;
- float r1=10000.0; //r1 valor
- float r2=100000.0; //r2 valor
- void setup()
- {
- Serial.begin(9600); //
- lcd.begin(16, 2); ////
- lcd.print("DC DIGI VOLTMETRO");
- }
- void loop()
- {
- int analogvalue = analogRead(A0);
- temp = (analogvalue * 5.0) / 1024.0; //
- input_volt = temp / (r2/(r1+r2));
- if (input_volt < 0.1)
- {
- input_volt=0.0;
- }
- Serial.print("v= "); //
- Serial.println(input_volt);
- lcd.setCursor(0, 1);
- lcd.print("Voltage= "); //
- lcd.print(input_volt);
- delay(300);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement