You just need your device's MAC address (which you can see on the EspruinoHub status page at pi:1888/status) - for instance in my case it's c6:a8:1a:1f:87:16.
Then you just send "\x10E.showMessage('Hello')\n" to "/ble/write/c6:a8:1a:1f:87:16/nus/nus_tx" via MQTT.
For instance sending "\x10E.showMessage('Hello')\n" should write 'hello' on the screen.
Or you could send "\x10myStatus=1234;\n" or maybe if you define a function in your Bangle.js app called setStatus then you can just call "\x10setStatus(123)\n"
The \x10 (char code 16) isn't required, but it just stops the Bangle 'echoing' the characters back via Bluetooth which can make it more reliable if you send loads of data.
Worth noting that it's hard to use the mosquitto_pub command to send newlines/escape codes. You can do:
The trailing slash on the line is important as that allows you to send a newline inside a string argument, but it's a bit hacky and it'd be better if you can send directly from within your application.
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.
Hi! Yes, you can definitely do that pretty easily with EspruinoHub.
There's a bit of info on the commands to send here: https://github.com/espruino/EspruinoHub#connections
You just need your device's MAC address (which you can see on the EspruinoHub status page at
pi:1888/status
) - for instance in my case it'sc6:a8:1a:1f:87:16
.Then you just send
"\x10E.showMessage('Hello')\n"
to"/ble/write/c6:a8:1a:1f:87:16/nus/nus_tx"
via MQTT.For instance sending
"\x10E.showMessage('Hello')\n"
should write 'hello' on the screen.Or you could send
"\x10myStatus=1234;\n"
or maybe if you define a function in your Bangle.js app calledsetStatus
then you can just call"\x10setStatus(123)\n"
The
\x10
(char code 16) isn't required, but it just stops the Bangle 'echoing' the characters back via Bluetooth which can make it more reliable if you send loads of data.Worth noting that it's hard to use the
mosquitto_pub
command to send newlines/escape codes. You can do:The trailing slash on the line is important as that allows you to send a newline inside a string argument, but it's a bit hacky and it'd be better if you can send directly from within your application.