From cd60598232a8b726db6b0f34ff68f12eaec40938 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 27 Sep 2020 21:32:57 +0200 Subject: receive-test.py: main --- receive-test.py | 19 +++++++++---------- 1 file 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)) -- cgit v1.2.3