Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float vout = 0.0;
- float vin = 0.0;
- float R1 = 997000.0; // resistance of R1 (100K) -see text!
- float R2 = 98500.0;
- void setup() {
- Serial.begin(9600);
- lcd.setcursor(0;0);
- lcd.print("Ubat ")
- }
- void loop() {
- float value = analogRead(A0);
- vout = (value * 5.0) / 1024.0;
- vin = vout / (R2/(R1+R2));
- Serial.println(vin);
- vin = vin * 10;
- Vin = map(vin, 210, 294 , 0, 100);
- lcd.setcursor(0,5);
- lcd.print(vin);
- }
Add Comment
Please, Sign In to add comment