Thanks Gordon,
I have tried your suggestion but bleak throws an error, which I will show below.
My single quotes show jason.dump etc as before. This is also below.
However I am confused, as per conversation with fanoush, I thought my problem is for my function to convert the bytearray back to a string using javascript. ( Icant find a way to do this yet) but any clarity on this matter would help.
With the following
command = "Y("+json.dumps(dict)+")\n"
gives an error. Note I am not convinced that this is due to the command line as bleak seems a bit unstable.
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 146, in connect
raise BleakError(str(e))
bleak.exc.BleakError: org.bluez.Error.Failed: Software caused connection abort
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 Gordon,
I have tried your suggestion but bleak throws an error, which I will show below.
My single quotes show jason.dump etc as before. This is also below.
However I am confused, as per conversation with fanoush, I thought my problem is for my function to convert the bytearray back to a string using javascript. ( Icant find a way to do this yet) but any clarity on this matter would help.
With the following
gives an error. Note I am not convinced that this is due to the command line as bleak seems a bit unstable.
With this
Connecting...
Connected
Writing command
RX> bytearray(b"Y(\'+json.dumps(dict)")
RX> bytearray(b"Y(\'+json.dumps(dict)")
RX> bytearray(b"+\')")
RX> bytearray(b"+\')")
RX> bytearray(b'\r\n')
RX> bytearray(b'\r\n')
Waiting for data
RX> bytearray(b'=undefined\r\n>')
RX> bytearray(b'=undefined\r\n>')
Done!
+json.dumps(dict)+
```