Thanks fanoush.
Re my understanding yes you are probably right.
To clarify I thought this line converted the python dictionary to a string:-
command = "X('+json.dumps(dict)+')/n"
and this line converted the json string to bytes:-
await client.write_gatt_char(UUID_NORDIC_TX,bytearray((c[0:20]),'utf-8') , True)
c = c[20:]
I thought this would then be sent and my function would decode the bytes back to a json string:-
E.showMessage("Hello Code");
function X(dict) {
msg = json.loads(dict.decode('utf-8'));
E.showMessage(msg);
}
I dont now get the previous error, but the bleak library seems a little unreliable and gives a connection failure after a few attempts. However I am getting no response on the watch so I cant say its working yet.
I will try ascii and see if there's a difference,but I really need a more reliable bluetooth tranfer code. Hopefully the code comes out OK.
Many thanks for your help.
mike
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks fanoush.
Re my understanding yes you are probably right.
To clarify I thought this line converted the python dictionary to a string:-
and this line converted the json string to bytes:-
I thought this would then be sent and my function would decode the bytes back to a json string:-
I dont now get the previous error, but the bleak library seems a little unreliable and gives a connection failure after a few attempts. However I am getting no response on the watch so I cant say its working yet.
I will try ascii and see if there's a difference,but I really need a more reliable bluetooth tranfer code. Hopefully the code comes out OK.
Many thanks for your help.
mike