• Hi - if you connect to the BLE UART service (which I think is what you might be doing?) then by default you're sharing it with the JavaScript REPL.

    The simplest method is just to wrap what you send in a function call. For instance if you send the string "\x10X({my:"data"})\n" and have a function called X then that function will be called automatically. The \x10 at the start turns 'echo' off so Espruino doesn't try and output what you wrote back to you

    OR you can handle data coming in with Bluetooth.on('data', function(d) { ... }) but only if you remove the REPL. E.setConsole(null) will remove the JS REPL so then the 'data' handler works (until you disconnect/reconnect) - you just need to be careful as moving the REPL means you can no longer write code to the device :)

    Or you could create another characteristic - but using the BLE UART is nice and easy

About

Avatar for Gordon @Gordon started