Created
May 16, 2017 14:32
-
-
Save proto-pic/8331ecb6d4cb521b225cea1e8a5820cb to your computer and use it in GitHub Desktop.
Arduino Based Volt Meter - Final
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
unsigned int analogIn = 0; | |
void setup() | |
{ | |
Serial.begin(115200); | |
} | |
void loop() | |
{ | |
for (int loopy = 0; loopy < 10; loopy++) | |
{ | |
analogIn = analogIn + analogRead(A0); | |
delay(10); | |
} | |
analogIn = analogIn / 10; | |
analogIn = map(analogIn, 0, 1023, 0, 10190); // The last value here has been trimmed - 9.2V on Milti-meter matches | |
Serial.print("@"); | |
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.print(analogIn, DEC); | |
Serial.print("#"); | |
delay(50); | |
analogIn = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment