Type ZUNO_HANDLER_SYSTIMER
This type binds handler to system software timer which triggers every 10 milliseconds. `sub_type` must be 0 for this event. handlerSysTimer(tick)tick: number of tick since the Z-Uno board began running the current program. You can get milliseconds from ticks by multiplying by 10. nothing
// Blink using system timer
byte state = HIGH;
byte dimmerValue=100;
size_t glob;
// Handler fuction
void handlerSysTimer(size_t tick) {
size_t ms;
ms = tick * 10;
if (ms >= glob) //if tick moment has come
{
glob = ms + dimmerValue*10; // define the next tick moment
digitalWrite(LED_BUILTIN, state);
state = !state; // invert state
}
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// Bind our handler to system timer ˜
zunoAttachSysHandler(ZUNO_HANDLER_SYSTIMER, 0, (void *)&handlerSysTimer);
glob = millis() + dimmerValue*10;
}
void loop() {
// There is nothing to do. All logic is inside handlerSysTimer()
}