// Define LED pin
#define LED_PIN 13
void setup() {
// Set LED pin as output
pinMode(LED_PIN, OUTPUT);
// Initialize Serial communication
Serial.begin(9600);
}
void loop() {
// Read analog value from potentiometer
int potValue = analogRead(A0);
// Map potentiometer value to delay time (50ms to 1000ms)
int delayTime = map(potValue, 0, 1023, 50, 1000);
// Blink LED with the calculated delay time
digitalWrite(LED_PIN, HIGH); // Turn LED on
delay(delayTime); // Wait
digitalWrite(LED_PIN, LOW); // Turn LED off
delay(delayTime); // Wait again
// Print potentiometer value and corresponding delay time
Serial.print("Potentiometer Value: ");
Serial.print(potValue);
Serial.print(", Delay Time: ");
Serial.print(delayTime);
Serial.println(" ms");
}