Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arduino Based Volt Meter - Final
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
You can’t perform that action at this time.