Measure time interval between two interrupt (RUI)

Could you please inform me the code in RUI to measure time interval between two interrupt ?
In arduino, usually, we use millis() function.

Regards,

Are you waiting for a certain amount of time or need to know how much time has passed? Do you need it down to tens of Millis?

So depending on what you have in mind, you can use https://doc.rakwireless.com/developer-tools/developer-tools/rui-timer-init to either monitor elapsed time (your own sys-tick) or to wait a certain amount of time.

I have a gated-power sensor output at 100 ms sampling rate. If the time interval between the two interrupt is in the range 100ms, then I ignore the second interrupt.

The first interrupt will wake up the RAK811 from sleep-mode.

So set a flag to true, run a timer for 100ms.

If the interrupt triggers, check the flag, if true, it was inside the 100ms

If the timer runs out, set flag to false. Next interrupt will be outside 100ms

When going in to sleep mode, set flag to false.

Although I’d be tempted to have a wasSleeping flag as well, so I can be clear in code about what state I was in when I got the interrupt

Thanks Nick @nmcc
It is good idea.
Regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.