Closed 0xRoM closed 5 years ago
Please don't edit your post. Other people may have the same issue. Now they have no clue what the issue was or the solution.
oh, ok sure... so problem was I was struggling to send hex (0x07) to a characteristic.
Heres how to do it:
#! /usr/bin/python3
import bluepy.btle as btle
chall_uuid = 0x36
p = btle.Peripheral("24:0a:c4:9a:7b:8e")
print ("Attached to peripheral")
services=p.getServices()
for service in services:
print (service)
svc=p.getServiceByUUID(0x00FF)
print(svc)
# the number to turn into hex (0x07)
x = 7
# put into bytearrray for python3
sendhex = bytes([x])
print (sendhex)
# send to the device, true=withresponse
response = p.writeCharacteristic(chall_uuid, sendhex, True)
print (response)
Solution found from: https://github.com/IanHarvey/bluepy/issues/53
Hope this helps someone
I'm an idiot!