Skip to content

Instantly share code, notes, and snippets.

@arduinothai
Created May 14, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arduinothai/127b4684f78d2534d067c4911eacf537 to your computer and use it in GitHub Desktop.
Save arduinothai/127b4684f78d2534d067c4911eacf537 to your computer and use it in GitHub Desktop.
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);// read the input on analog pin 0:
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
Serial.println(voltage); // print out the value you read:
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment