Created
September 30, 2016 10:59
-
-
Save elktros/0f4b928a34af5fe5607f1429632824a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LiquidCrystal.h" | |
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); | |
float voltage = 0.0; | |
float temp=0.0; | |
int analog_value; | |
void setup() | |
{ | |
lcd.begin(16, 2); | |
lcd.setCursor (0,0); | |
lcd.print(" Arduino based "); | |
lcd.setCursor(0,1); | |
lcd.print("Digital Voltmeter"); | |
delay(2000); | |
} | |
void loop() | |
{ | |
analog_value = analogRead(A0); | |
temp = (analog_value * 5.0) / 1024.0; | |
voltage = temp/(0.0909); | |
if (voltage < 0.1) | |
{ | |
voltage=0.0; | |
} | |
lcd.clear(); | |
lcd.setCursor(0, 0); | |
lcd.print("Voltage= "); | |
lcd.print(voltage); | |
lcd.setCursor(13,1); | |
lcd.print("V"); | |
delay(30); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment