summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2020-09-27 21:32:57 +0200
committerPatrick Simianer <p@simianer.de>2020-09-27 21:32:57 +0200
commitcd60598232a8b726db6b0f34ff68f12eaec40938 (patch)
treec86503fa5df4de779e4b3e58396adc06731b4073
parent0f75bd5a2e2e456ff80546174dcf0aba944e65a3 (diff)
receive-test.py: main
-rwxr-xr-xreceive-test.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/receive-test.py b/receive-test.py
index cb95d7c..c1d9783 100755
--- a/receive-test.py
+++ b/receive-test.py
@@ -3,14 +3,13 @@
from RFXtrx import PySerialTransport
import sys, datetime, os
-transport = PySerialTransport('/dev/ttyUSB0')
-transport.reset()
-
-while True:
- if os.path.isfile('./stop'):
- break
-
- timestamp = datetime.datetime.timestamp(datetime.datetime.now())
- recv = transport.receive_blocking()
- print(str(recv))
+if __name__ == "__main__":
+ transport = PySerialTransport('/dev/ttyUSB0')
+ transport.reset()
+ while True:
+ if os.path.isfile('./stop'):
+ break
+ timestamp = datetime.datetime.timestamp(datetime.datetime.now())
+ recv = transport.receive_blocking()
+ print(str(recv))