situation: - server ( ST X-NUCLEO-IDB05A1 ( BLE Module) + ST NUCLEO-F103RB)
client ( RaspBerry Pi3 + Python 3.5 )
I'm trying to write a value in a characteristic but when I read the value , never change.
The characteristic has the property READ and WRITE for both ( server and client)
The script of python is this:
import os
import sys
from bluepy import btle
import time
import struct
import binascii
situation: - server ( ST X-NUCLEO-IDB05A1 ( BLE Module) + ST NUCLEO-F103RB)
I'm trying to write a value in a characteristic but when I read the value , never change. The characteristic has the property READ and WRITE for both ( server and client)
The script of python is this:
import os import sys from bluepy import btle
import time import struct import binascii
''' Initialisation ''' gatewayStatus =("d973f2e5-b19e-11e2-9e96-0800200c9a66") service_uuid = btle.UUID("d973f2e6-b19e-11e2-9e96-0800200c9a66") char_uuid = btle.UUID("d973f2e7-b19e-11e2-9e96-0800200c9a66")
btle.DefaultDelegate p = btle.Peripheral('02:80:e1:01:01:aa',btle.ADDR_TYPE_PUBLIC, 0) print("Conectado") p.disconnect() print("Desconectado") p.connect('00:0B:57:28:1F:8B',btle.ADDR_TYPE_PUBLIC, 0) svc = p.getServiceByUUID(service_uuid) print(svc) ch= svc.getCharacteristics(char_uuid)[0] print(ch) write_handle = ch.getHandle() valuebytes = bytes([2]) print(valuebytes) p.writeCharacteristic(write_handle, valuebytes)
ch.write(valuebytes)
result = p.readCharacteristic(write_handle) print(result) p.disconnect()
What is the problem?