Skip to content

Instantly share code, notes, and snippets.

@arduinothai
Created May 18, 2018 17:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arduinothai/b16f0568593861f37b7f175c65a45002 to your computer and use it in GitHub Desktop.
Save arduinothai/b16f0568593861f37b7f175c65a45002 to your computer and use it in GitHub Desktop.
int analogPin = A0; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read
void setup()
{
Serial.begin(9600); // setup serial
}
void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment