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