Add routine

This commit is contained in:
David Wright 2022-09-26 21:39:20 -06:00
parent ea6c4f5e1f
commit 7ee713749f

View File

@ -33,6 +33,11 @@ class Droid():
finally: finally:
await self.droid.disconnect() await self.droid.disconnect()
print("Disconnected") 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): def findDroid(candidate, data):
if candidate.name == "DROID": if candidate.name == "DROID":
return True return True
@ -45,5 +50,9 @@ async def main():
arms = Droid(myDroid) arms = Droid(myDroid)
await arms.connect() await arms.connect()
sleep (3) sleep (3)
try:
await arms.run_routine("05")
sleep (3)
finally:
await arms.disconnect() await arms.disconnect()
asyncio.run(main()) asyncio.run(main())