Plug it and Arduino read rotation !
This post is a copy of the Original post on EBay. I am replicating it here because ended items on Ebay are not indexed by Google, the author’s page is written in Chinese and doesn’t contains the Source code. If you are the author and you are obset with this, please get in touch.
This Potentiometer module is a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value. By turning the shaft of the potentiometer, we change the input signal to analog pin.
Building interactive work is as easy as piling bricks, just plug it to our Arduino Sensor Shield with a buckled cable, and make it looks professional and neat.

The code below controls frequency of on and off of a LED light ,
int potPin = 4; // pin for potentiometer
int ledPin = 13; // pin for LED
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT); // state ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin);
digitalWrite(ledPin, HIGH);
delay(val);
digitalWrite(ledPin, LOW);
delay(val);
}


PotentiometerSensor Source code
Recent Comments