How to make a led pulse / flash?

Sweet Angels I got it!! :crazy_face:

Ok so TLDR of the thread, in order to make a blinking LED work you can do something like this.
We need

  • 2 Button Widgets (or more)
  • 1 Script Widget (functionDefinitions I call it normally , I declare all the global functions on there)
  • 1 Variable Widget (resetCss )

buttons (they are similar to each other just different ID's)

"type": "button",
(....)
"id": "button_1",
(...)
"css": ":host.on {
    animation: mainBlink 1s infinite;
    @{resetCss}
}",
(...)
"script": "globals.resetBlink();"

functionDefinitions

"type": "script",
"id": "functionDefinitions",
(...)
"script": "globals.resetBlink = function resetBlink () {
  set('resetCss', 'animation:none')
  setTimeout(()=>{
  set('resetCss', '')
  })
}",
"event": "once",
(...)

resetCss

"type": "variable",
"id": "resetCss",
(...)

resetCssAnim-2.json (5.2 KB)

1 Like