From 7ee713749f171a31e0cda1ac0f6d30b374604f70 Mon Sep 17 00:00:00 2001 From: David Wright Date: Mon, 26 Sep 2022 21:39:20 -0600 Subject: [PATCH] Add routine --- droid.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/droid.py b/droid.py index d937725..a7531bc 100644 --- a/droid.py +++ b/droid.py @@ -33,6 +33,11 @@ class Droid(): finally: await self.droid.disconnect() print("Disconnected") + + async def run_routine(self, routineId): + full_id = bytearray.fromhex("25000c42{}02".format(routineId)) + await self.droid.write_gatt_char(0x000d, full_id) + def findDroid(candidate, data): if candidate.name == "DROID": return True @@ -45,5 +50,9 @@ async def main(): arms = Droid(myDroid) await arms.connect() sleep (3) - await arms.disconnect() + try: + await arms.run_routine("05") + sleep (3) + finally: + await arms.disconnect() asyncio.run(main()) \ No newline at end of file