Advertisement
AdamBB

Voltage measurer 5V

Jan 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<LiquidCrystal.h>
  2. LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
  3. int pomiar=A0;
  4. int odczyt;
  5.  
  6. void setup() {
  7.   Serial.begin(9600);
  8.   lcd.begin(16, 2);
  9.   lcd.print("Napiecie wynosi:");
  10. }
  11.  
  12. void loop() {
  13.   int sensorVoltage=analogRead(pomiar);
  14.   float voltage = sensorVoltage * (5.00 / 1024.00);
  15.   lcd.setCursor(0, 1);
  16.   lcd.print("U=" + (String)voltage + " V");
  17.   Serial.println(voltage);
  18.   delay(1000);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement