int LEDpin = 8; //pin 8 will control the LED
void setup() {
// put your setup code here, to run once:
pinMode(LEDpin,OUTPUT);
}
void loop() {
// analogRead(A0) will give us the changing voltage value as we
//move the wiper of the potentiometer.
int value = analogRead(A0);
digitalWrite(LEDpin, HIGH); //LED ON
delay(value); // voltage value
digitalWrite(LEDpin, LOW); //LED OFF
delay(value);
Serial.println(value);
//Serial.println() is used to print the voltage values on the console
}