Timer Feature not working as expected

Within the setup there is an option the have the board turn the LEDs off and on at set times. I gave a set of these lights to my daughter for her birthday and she uses them as a nightlight. When I set the time to turn off as an AM time and the turn on as PM the lights do not turn on. I tried several times with the off AM/on PM configuration and it never turned them on. The first time I switched the off to a PM time, they turned off as it got to the set time. Is there something that I’m missing?

Hi @justinmd,
I think you have it right, the on/off setting turns off the LEDs if the time is after the OFF time or before the ON time.

It’s also possible to implement in pattern code by checking clockHour() and so on and can implement what you are looking for.

You can try something like this to turn on fro 8pm through 8:59am in beforeRender():

isOn = clockHour() <= 8 || clockHour() >= 20

Then multiply (since true values are 1, false are 0) by the last value to hsv, or each value to rgb in render() or just conditionally call hsv/rgb with zeros.

Here’s a basic rainbow set up like that:

export var isOn
export function beforeRender(delta) {
  isOn = clockHour() <= 8 || clockHour() >= 20
  t1 = time(.1)

export function render(index) {
  h = t1 + index/pixelCount
  s = 1
  v = 1
  hsv(h, s, v * isOn)

awesome, thanks for the reply

Yes, the timer logic is wrong.
I wanted turn off at 1AM, on at 9AM.
That’s a well defined segment of a 24 hour cycle, but to get it to work I had to turn off at 11:59pm.
This really should get fixed!

1 Like