I know I can set a timer to go off every sixty seconds, but is there a way to start at 0 seconds past the minute? Or on exactly 0 seconds and 30 seconds past?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Clocks usually use the
setTimeout
method like this: https://github.com/espruino/BangleApps/blob/c4f9d7757912442df66b21038322ee65acf53b53/apps/waveclk/app.js#L21-L24The 60000 - (Date.now() % 60000) part returns the millis to the next minute.