Advertisement
Braulio777

Arduino Power Supply 0 - 5V

Mar 13th, 2016
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. //Arduino Power Supply 0-5Volt
  2. #include <LiquidCrystal.h>
  3. LiquidCrystal lcd(12, 10, 5, 4, 3, 2);
  4. int potPin = A0;
  5. int readValue;
  6. float Voltage;
  7.  
  8. void setup(){
  9. pinMode(potPin, INPUT);
  10. lcd.begin(16, 2);
  11. }
  12.  
  13. void loop(){
  14. readValue = analogRead(potPin);
  15. Voltage = (5./1023)*readValue;
  16. lcd.setCursor(0,0);
  17. lcd.print("Voltage = ");
  18. lcd.setCursor(0,1);
  19. lcd.print(Voltage, 3);
  20. lcd.print("V");
  21. delay(250);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement