Advertisement
safwan092

Untitled

Oct 9th, 2023
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x27, 16, 2);
  5.  
  6. float reading = 0;
  7. float Voltage = 0;
  8. float Voltage_AC = 0;
  9.  
  10. void setup() {
  11.  
  12. pinMode(A1, INPUT);
  13. lcd.init();
  14. lcd.init();
  15. lcd.backlight();
  16. lcd.setCursor(0, 0);
  17. lcd.print("Hello world...");
  18. delay(5000);
  19. lcd.clear();
  20.  
  21. }
  22.  
  23. void loop() {
  24. lcd.clear();
  25. reading = analogRead(A1);
  26. Voltage = ((reading * 5.00) / (1023.00));
  27. Voltage_AC = ((Voltage * 53.65));//(Voltage * 101.38);
  28. lcd.setCursor(0, 0);
  29. lcd.print("V= ");
  30. lcd.print(Voltage);
  31. lcd.print("V ");
  32. lcd.print(reading);
  33. lcd.setCursor(0, 1);
  34. lcd.print("V_AC= ");
  35. lcd.print(Voltage_AC);
  36. lcd.print("V");
  37. delay(1000);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement