Thingy:52 Python Script—Binary Format

Hi I'm currently using the sample py script which is given in  https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/nordic-thingy52-raspberry-pi-python-interface, it connects with my thingy, but it shows the values in different format.

# Setting notification handler to new handler...
# Setting notification handler to new handler...
# Configuring and enabling temperature notification...
# Waiting for three notifications...
b'1d34'
b'1d27'
b'1d38'
# Disconnecting...

my code:

from bluepy import btle, thingy52
import time
import binascii

MAC_ADDRESS = "CC:53:EB:90:19:06"  # This has to be changed to match your Thingy's MAC!
thingy = thingy52.Thingy52(MAC_ADDRESS)
thingy.sound.enable()
#while True:
thingy.sound.configure(speaker_mode=0x03)  # 0x03 means sample mode, ref FW doc
thingy.sound.play_speaker_sample(5)
time.sleep(2)

thingy.sound.play_speaker_sample(5)
time.sleep(2)
class NewDelegate(btle.DefaultDelegate):
    def handleNotification(self, hnd, data):
        if (hnd == thingy52.e_temperature_handle):
            print(binascii.b2a_hex(data))

#print("# Setting notification handler to default handler...")
#thingy.setDelegate(thingy52.MyDelegate())
print("# Setting notification handler to new handler...")
thingy.setDelegate(NewDelegate())

print("# Setting notification handler to new handler...")
thingy.setDelegate(NewDelegate())

print("# Configuring and enabling temperature notification...")
thingy.environment.enable()
thingy.environment.configure(temp_int=1000)
thingy.environment.set_temperature_notification(True)


print("# Waiting for three notifications...")
thingy.waitForNotifications(timeout=5)
thingy.waitForNotifications(timeout=5)
thingy.waitForNotifications(timeout=5)

print("# Disconnecting...")

Parents Reply Children
No Data
Related