![]() |
|
long press --> ciclyc sending - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Visu (https://forum.logicmachine.net/forumdisplay.php?fid=24) +--- Thread: long press --> ciclyc sending (/showthread.php?tid=6549) |
long press --> ciclyc sending - toujour - 16.09.2026 Hi Guys, Can I use a long press to trigger a repeating send action as long as I hold down the button? (without logic, but using JavaScript) KR, Alberto RE: long press --> ciclyc sending - admin - 21.09.2026 Use this for Short/long press widget. This example will send a counter value to 0/0/13 every 500ms during long press hold. Change widgetId and other parameters as needed. Code: const widgetId = 98
Visu.on('widget-ready', widgetId, ({ widget }) => {
let timer
let counter
const timerFn = () => {
localbus.write('0/0/13', counter)
counter++
}
widget.compactModeLongPress = () => {
widget.setPressed(true)
counter = 0
timer = setInterval(timerFn, 500)
timerFn()
}
widget.compactModeLongRelease = () => {
clearInterval(timer)
widget.setPressed(false)
}
}) |