-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwritemsg1.py
32 lines (27 loc) · 1.07 KB
/
writemsg1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import pygatt
from time import sleep
DELAY=0.1
adapter = pygatt.GATTToolBackend()
try:
adapter.start()
device = adapter.connect('F5:91:E3:32:23:39',address_type=pygatt.BLEAddressType.random)
while True:
device.char_write_handle(0x27, bytearray([0x1F, 0x11, 0x11, 0x11, 0x1F]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x0E, 0x0A, 0x0E, 0x00]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x00, 0x04, 0x00, 0x00]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x00, 0x00, 0x00, 0x00]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x11, 0x0A, 0x04, 0x0A, 0x11]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x0A, 0x04, 0x0A, 0x00]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x00, 0x04, 0x00, 0x00]))
sleep(DELAY)
device.char_write_handle(0x27, bytearray([0x00, 0x00, 0x00, 0x00, 0x00]))
sleep(DELAY)
finally:
adapter.stop()