# how to set LED frequency?

I have 7 leds blinking simultaneously, where delay is 50ms, does it mean it blinks at frequency 20Hz?
What if delay would be 5ms it would mean that the leds would make 200 cycles per second, is it possible to see the blinking if it's so fast?

``````void loop()
{
setStrip(next_red);
if (next_red == 0) {
next_red = 255;
} else {
next_red = 0;
}
delay(50);
}
``````

I don’t think anyone can see flashing beyond about 50 or 60 Hz

Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.

where delay is 50ms, does it mean it blinks at frequency 20Hz?

No. The blink rate depends on the total time the loop takes to execute (not just the delay). Since the LED state alternates, the blink rate is 10 Hz or less.

jremington:
Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.
No. The blink rate depends on the total time the loop takes to execute (not just the delay). Since the LED state alternates, the blink rate is 10 Hz or less.

why less than 10hz? 50ms+50md, total cycle time of 100mS =10Hz. What is the margin of error?

where delay is 50ms, does it mean it blinks at frequency 20Hz?

No. It's on for 50ms and off for 50ms so a complete cycle is 100ms = 10Hz.

It's actually slightly-slower because the code in-between delays takes some microseconds to execute. The code/library used to address the LED strip could take a little longer.

Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.

Each frame is shown twice for a "flicker rate" of 48Hz (or sometimes 3 times).

it would mean that the leds would make 200 cycles per second, is it possible to see the blinking if it's so fast?

Why don't you try it? Sometimes I can perceive flicker in my peripheral vision and then I can't see it when I look directly at the light source. (That might be around 30Hz.) You can also get a "strobe effect" if you move the LED or sometimes if you just move your head or eyes a little.

TheMemberFormerlyKnownAsAWOL:
I don't think anyone can see flashing beyond about 50 or 60 Hz

https://youtu.be/opnn7VybOlI - this device can go even 300 cycles per second, and you can see the blinking, how to program it?

Don't be quick to believe anything you see on video.

this device can go even 300 cycles per second, and you can see the blinking

How fast is the frame rate of the camera that shot the video?

TheMemberFormerlyKnownAsAWOL:
How fast is the frame rate of the camera that shot the video?

I don't know, but of course camera can't catch it.

It’s very easy to try it. Then you can tell us how fast a blink rate YOU can see.

Steve

slipstick:
It's very easy to try it. Then you can tell us how fast a blink rate YOU can see.

Steve

I set delay(13) so I get 38,5Hz, and this is the maximum that I can still see blinking instead of steady light.

So how that device https://youtu.be/opnn7VybOlI could go 300Hz per second?

So how that device https://youtu.be/opnn7VybOlI could go 300Hz per second?

Maybe they used delayMicroseconds

https://youtu.be/opnn7VybOlI - this device can go even 300 cycles per second, and you can see the blinking

Of course the video isn't showing 300Hz... The video frame rate can combine with the flash-rate and you can get some "strange results".

Have you ever seen an old Western movie where the wagon wheels appeared to be turning backwards? Have you ever played-around with a strobe light and a fan (or anything that rotates)?

DVDdoug:
Of course the video isn't showing 300Hz... The video frame rate can combine with the flash-rate and you can get some "strange results".

Have you ever seen an old Western movie where the wagon wheels appeared to be turning backwards? Have you ever played-around with a strobe light and a fan (or anything that rotates)?

Yes, but technically it's possible

Yes, but technically it's possible

What's technically possible? Of course it's easy to blink an LED faster than 300Hz but the video can't show 300 flashes per second with a frame rate around 30 frames per second.

Again, just try it yourself. Set the LED to flash at 200-300Hz, video record it (most phones will do that) and play it back.

Steve

slipstick:
Again, just try it yourself. Set the LED to flash at 200-300Hz, video record it (most phones will do that) and play it back.

Steve

I did it, but there is no difference between 40+Hz(particularly 300Hz) and a steady light.
You can see 2 videos in attachments.

Someone has written that it is needed to use delayMicroseconds to make this effect visible, is there somewhere an exmple code on how to do it?

use delayMicroseconds to make this effect visible

This will not make the effect visible, but for 300Hz, the on/off times must be given in microseconds instead of milliseconds.

1667 microseconds on/off for 300 Hz.

There are no fractional millisecond values so you can only use values of 1 or 2 which will give 500 or 250 Hz.

cattledog:
This will not make the effect visible, but for 300Hz, the on/off times must be given in microseconds instead of milliseconds.

1667 microseconds on/off for 300 Hz.

There are no fractional millisecond values so you can only use values of 1 or 2 which will give 500 or 250 Hz.

https://lannayoga.com/ajnalight/wp-content/uploads/2020/05/Users-Manual-AL3-2.pdf - but they make it somehow visible so that your brain can adjust to the LEDS frequency in this case it's lambda wave(page 45), which is 100-300Hz.