/*
controlled flashing light using potentiometers.
made on 1st March 2023
by Essam Harous
http://www.arduino.cc/en/Tutorial/Knob
*/
int potpin = A0; // analog pin used to connect the potentiometer
int ledPin = 2; // digital pin used to connect the LED
int val; // variable to read the value from the analog pin
void setup() {
pinMode(ledPin, OUTPUT);; // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
digitalWrite(ledPin, HIGH); // run led pin
delay(val); // waits for the servo to get there
digitalWrite(ledPin, LOW); // run led pin
delay(val); // waits for the servo to get there
}