Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Arduino Power Supply 0-5Volt
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(12, 10, 5, 4, 3, 2);
- int potPin = A0;
- int readValue;
- float Voltage;
- void setup(){
- pinMode(potPin, INPUT);
- lcd.begin(16, 2);
- }
- void loop(){
- readValue = analogRead(potPin);
- Voltage = (5./1023)*readValue;
- lcd.setCursor(0,0);
- lcd.print("Voltage = ");
- lcd.setCursor(0,1);
- lcd.print(Voltage, 3);
- lcd.print("V");
- delay(250);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement