Created
July 27, 2014 00:01
-
-
Save djuretic/f791984f15eaf229ee96 to your computer and use it in GitHub Desktop.
Microview voltage
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 <MicroView.h> | |
void setup(){ | |
uView.begin(); | |
uView.clear(PAGE); | |
pinMode(A0, INPUT); | |
digitalWrite(A0, HIGH); | |
} | |
void loop(){ | |
uView.clear(PAGE); | |
int result = analogRead(A0); | |
uView.setCursor(0,0); | |
uView.print("A0"); | |
uView.setCursor(20, 0); | |
uView.print(result); | |
float voltage = result * (5.0 / 1023.0); | |
uView.setCursor(0, 10); | |
uView.print("V"); | |
uView.setCursor(20, 10); | |
uView.print(voltage); | |
uView.display(); | |
delay(200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment