Advertisement
gabbyshimoni

basic-use-of-potentiometer

Nov 12th, 2018
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #define potPin A0    // select the input pin for the potentiometer
  2. int potValue = 0;  // variable to store the value coming from the sensor
  3.  
  4. void setup() {
  5.   // declare the ledPin as an OUTPUT:
  6.   Serial.begin(9600);
  7. }
  8.  
  9. void loop() {
  10.   // read the value from the sensor:
  11.   potValue = analogRead(potPin);
  12.   Serial.print("pot value=");
  13.   Serial.println(potValue);
  14.   delay(100);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement