PulseCounter
pulse counter is an example of an ACT.
The pulse counter counts the number of rising or falling pulses of a signal without intervening microcontroller. It can be used to count irregular pulses and send wireless packets when the count reaches a certain number of times.
Function of ACT
Counts the pulses connected to DIO8 on the Child Node side and transmits them wirelessly after a certain period of time or when a certain number of counts are detected.
The Child Node side operates while sleeping.
How to use ACT
Required TWELITE
Role | Example |
---|---|
Parent Node | MONOSTICK BLUE or RED ACT Parent_MONOSTICK in action.。 |
Child Node |
Explanation of ACT
setup()
Initializes the pulse counter.
begin()
Starts the pulse counter operation and performs the first sleep. The first parameter of PulseCounter.begin()
is the count number 100
to generate a wake-up interrupt, and the second is the falling detection PIN_INT_MODE::FALLING
.
wakeup()
Checks PulseCounter.available()
when waking up. available, that is, true
, indicates that the count is greater than or equal to the specified count. If it is false
, it resleeps.
If the count is more than the specified number, loop()
processes the transmission and waits for the completion of the transmission.
loop()
Reads the pulse count value. The counter is reset after the readout.
最終更新