From 9c2eb6379b97080d9ba8295b0b8eb37318d710d0 Mon Sep 17 00:00:00 2001 From: Boyan Date: Wed, 20 Jul 2022 19:18:34 +0300 Subject: [PATCH] fixed indent --- main.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index 3dd8eef..8a8fb06 100644 --- a/main.py +++ b/main.py @@ -21,19 +21,11 @@ async def button_press(gpio:int, level) -> bool: asyncio.sleep(.5) async def ptt(): - if PTT_IS_ON == 1: - print("HEEEEEE") + while True: + if PTT_IS_ON == 1: + print("HEEEEEE") if __name__ == "__main__": loop = asyncio.get_event_loop() - task = loop.create_task(button_press(10, pigpio.EITHER_EDGE)) - task2 = loop.create.task(ptt()) - try: - loop.run_until_complete(task2) - loop.run_until_complete(task) - except asyncio.CancelledError: - pass - - while True: - if PTT_IS_ON == 1: - print("WE'RE LIVE") + tasks = asyncio.gather(button_press(10, pigpio.EITHER_EDGE), ptt()) + asyncio.get_event_loop().run_until_complete(tasks) \ No newline at end of file