forked from platypush/platypush
Added utility to scan for messages on the ZeroBorg infrared sensor
This commit is contained in:
parent
cb30a0418f
commit
0939cdedf8
2 changed files with 23 additions and 0 deletions
23
platypush/backend/sensor/ir/zeroborg/scan.py
Normal file
23
platypush/backend/sensor/ir/zeroborg/scan.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import time
|
||||
|
||||
import platypush.plugins.gpio.zeroborg.lib as ZeroBorg
|
||||
|
||||
no_msg_timeout = 0.37
|
||||
last_msg = None
|
||||
last_msg_timestamp = None
|
||||
auto_mode = False
|
||||
|
||||
ZB = ZeroBorg.ZeroBorg()
|
||||
ZB.Init()
|
||||
|
||||
while True:
|
||||
ZB.GetIrMessage()
|
||||
if ZB.HasNewIrMessage():
|
||||
message = ZB.GetIrMessage()
|
||||
print('Received message: {}'.format(message))
|
||||
|
||||
last_msg = message
|
||||
last_msg_timestamp = time.time()
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
Loading…
Reference in a new issue