Added utility to scan for messages on the ZeroBorg infrared sensor

This commit is contained in:
Fabio Manganiello 2018-06-26 00:16:04 +02:00
parent cb30a0418f
commit 0939cdedf8
2 changed files with 23 additions and 0 deletions

View 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: