Created
May 16, 2017 14:25
-
-
Save proto-pic/b3c6908c4109034bb8cb27dfcf4d0e7a to your computer and use it in GitHub Desktop.
Arduino Volt Meter
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
int myVoltageReading = 5.14; | |
unsigned int analogIn = 0; | |
void setup() | |
{ | |
Serial.begin(115200); | |
} | |
void loop() | |
{ | |
analogIn = analogRead(A0); | |
analogIn = map(a, 0, 1023, 0, myVoltageReading * 1000); | |
if (analogIn < 10) Serial.print("0"); | |
if (analogIn < 100) Serial.print("0"); | |
if (analogIn < 1000) Serial.print("0"); | |
if (analogIn < 10000) Serial.print("0"); | |
Serial.println(a, DEC); | |
delay(150); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment