Add routine
This commit is contained in:
parent
ea6c4f5e1f
commit
7ee713749f
9
droid.py
9
droid.py
|
@ -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())
|
Loading…
Reference in New Issue
Block a user