Last active
October 20, 2019 15:18
-
-
Save techzeero/9765de4b137af8637c6feff9eaf5fae6 to your computer and use it in GitHub Desktop.
Potentiometer with Arduino :- https://techzeero.com/arduino-tutorials/how-to-use-potentiometer-with-arduino/
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
/* | |
How to use Potentiometer with Arduino | |
For more details, visit: https://techzeero.com/arduino-tutorials/how-to-use-potentiometer-with-arduino/ | |
AnalogReadSerial | |
Reads an analog input (potentiometer) on pin 0, | |
prints the result to the serial monitor. | |
OPEN THE SERIAL MONITOR TO VIEW THE OUTPUT FROM THE POTENTIOMETER >> | |
Attach the center pin of a potentiometer to pin A0, | |
and the outside pins to +5V and ground. | |
*/ | |
int sensorValue = 0; | |
void setup() | |
{ | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
// read the input on analog pin 0: | |
sensorValue = analogRead(A0); | |
// print out the value you read: | |
Serial.println(sensorValue); | |
delay(10); // Delay a little bit to improve simulation performance | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment