int potPin = 2; // select the input pin for the potentiometer
int ledPin = 8; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read value from the sensor
val = val/4;
Serial.println(val); // read the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val/32); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val/8); // stop the program for some time
}