Site Navigation

Your Account

Choose Language

Set Dazzle to precisely 40 flashes per second

Does anyone know how to set Dazzle mode to precisely 40 flashes per second.

What seems like what should be a relatively simple task appears quite complicated.

Thanks

Answer this question I have this problem too

Is this a good question?

Score 0
Add a comment

1 Answer

If you're looking for 40 flashes per second, that's 1000/40 = 25ms.

If you're using tactical.ino, then look for the line:

if(flash_time+70<millis()) { // flash every 70 milliseconds

Replace that 70 with 25.

If you're using hexbright_demo_dazzle.ino, then look for the line:

if (millis() - lastTime > 10)

Replace that > 10 with >= 25.

Note that you may never get exactly 40 flashes per second and may have to settle for 'close enough', as code execution and the internal timers mean there's only a strict set of frequencies that can be hit exactly. You can see some of that in the code itself, which (for the dazzle demo code), simply checks if more than 10 milliseconds have passed since the lastTime it flashed. This could be 11ms, but it could just as well be 15ms depending on other code being executed.

Was this answer helpful?

Score 0
Add a comment

Add your answer

Rick will be eternally grateful.
View Statistics:

Past 24 Hours: 0

Past 7 Days: 0

Past 30 Days: 0

All Time: 110