X-Git-Url: https://git.toastfreeware.priv.at/toast/airingbutler.git/blobdiff_plain/8668609a5e80454830b5f0fd1af52f5e52fe0690..542c509c47cdae3a08d4217940c6cfb2ccfcd0fc:/log_mhz19.py diff --git a/log_mhz19.py b/log_mhz19.py index 18ffb11..7dea051 100755 --- a/log_mhz19.py +++ b/log_mhz19.py @@ -28,7 +28,7 @@ class Receiver(asyncio.Protocol): def data_received(self, data): data = data.decode() - print(data, end='') + print(data, end='', flush=True) def connection_lost(self, exc): log.debug('port closed') @@ -40,7 +40,7 @@ def main(): parser.add_argument('--device', '-d', default='/dev/ttyACM0', help='Device where Arduino is connected to') args = parser.parse_args() logging.basicConfig(level=logging.INFO, format='%(asctime)-15s %(message)s') - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() coro = serial_asyncio.create_serial_connection(loop, Receiver, args.device, baudrate=115200) loop.run_until_complete(coro) loop.run_forever()