Timer counter code?

Sorry im new here to openMV, i was wondering if it’s possible to code a counter into the timer function so that i can send out data every 30 seconds

any help would be appreciated. thank you

while(true):
clock.tick()
[blob counting codes]

[code to send data every 30 sec]
uart.write

Yep, use the PYB timers: class Timer – control internal timers — MicroPython 1.15 documentation

Alternatively, just check pyb.millis() and trigger when 30 seconds passes.

Sorry, correct me if i am wrong but wouldnt this only trigger once instead of periodically every 30sec?

You’d want to change the mode to be periodic.

Anyway, for what you want to do you don’t need a counter:

https://docs.openmv.io/library/pyb.html#pyb.elapsed_millis

Use this method.

1 Like