# Blinking LED with variable frequency

Hi,
I want to write a program, for blinking LED with the variable frequency of 10 - 100 Hz. I should use the potentiometer as a Voltage divider for generating the analogue input voltage.

Come back when you have a successfully blinking led and if you can’t work out how to change the period.

Do you know how to read a pot with an analogue input and get a value between 0 and 1023 ?

What range of values do you want for the period ?

Do you want like this --?
1. When input voltage is 0V, the LED (L of UNO) will blink at 1 Hz -- 1 blink in 1-sec time. That is to say, the interval between blinks is 1000 ms. The ON-period (timeDelay) of LED is 500 ms and the OFF-period is also 500 ms.

2. When input voltage is 5V, the LED will blink at 100 Hz - 100 blinks in 1-sec time. That is to say, the interval between blinks is 10 ms. The ON-period of LED is 5 ms and the OFF-period is also 5 ms.

3. For input voltage between 0V and 5V, the blink rate will be proportionate.

4. If the answer is yes, then the following codes may be helpful.

``````while(1)    //keep doing the following task.
{
byte timeDelay = map(analogRead(A0), 0, 1023, 500, 5);  //pot is connected at A0-pin
digitalwrite(13, HIGH);    //built-in LED (L) of UNO is connected with DPin-13.
delay(timeDelay);
digitalWrite(13, LOW);
delay(timeDelay);
}
``````

When is our assignment due to be handed in?

kasrat:
Hi,
I want to write a program, for blinking LED with the variable frequency of 10 - 100 Hz. I should use the potentiometer as a Voltage divider for generating the analogue input voltage.

Hi kasrat,

there is a lot of room for interprating what you expect as the answer.
As long as you do not ask in a more specific way, my answers are of a very general way