Using potentiometer and one of the Arduino's analog to digital (ADC) pins.It is possible to read the analog values from 0-1024. The following code program is an example which uses the potentiometer to control the LED's rate of blinking.
program code
int ledpin = 13;// input pin of the potentiometer
int potpin=0;// output pin of led
void setup ()
{
pinMode(ledpin,OUTPUT);//declare the output
}
void loop()
{
digitalWrite(ledpin,HIGH);//led pin on
delay(analogRead(potpin));//paused the program
digitalWrite(ledpin,LOW);//led pin off
delay(analogRead(potpin));//paused the program
}
program code
int ledpin = 13;// input pin of the potentiometer
int potpin=0;// output pin of led
void setup ()
{
pinMode(ledpin,OUTPUT);//declare the output
}
void loop()
{
digitalWrite(ledpin,HIGH);//led pin on
delay(analogRead(potpin));//paused the program
digitalWrite(ledpin,LOW);//led pin off
delay(analogRead(potpin));//paused the program
}