hi, i am new to arduino, using a nano and want to make pin 13 "blink" at random intervals. For example, make pin13 go "high" for a random amount of time (1000 - 10000ms) then go low for a random period (1000-10000ms) then repeat the process with new random numbers. Newbie here, so please forgive whats probably easy for an experiened user. thanks in advance!
There are 4 things you need to do.
- Select a random on time.
- Turn the LED on. Delay() for that amount of time.
- Select a random off time. Delay() for that amount of time.
- Turn the LED off.
Which part(s) do you need help with?
follow up to OP:
i don't know how to use the correct syntax to specify a random number (or range) as the "delay" time. thanks again!
i don't know how to use the correct syntax to specify a random number (or range) as the "delay" time.
unsigned long onTime = random(1000, 10001); // Generate a random number from 1000 to 10000
delay(onTime); // Twiddle thumbs for a while