-
• #2
Check this out: http://www.espruino.com/Puck.js+Node-RED#controlling-the-puck
You can have a custom Bluetooth service set up but this way just connects to the Puck's BLE UART and allows you to send JavaScript code to be executed.
-
• #3
I have seen this, but i would like to execute a function within my code.
-
• #4
Ok, all you do is:
- Write a function on Puck.js, maybe
function myFunction() { ... }
- Then send an MQTT packet like
"myFunction()\n"
to/ble/write/de:vi:ce:ad:dr/nus/nus_tx
If you're interested in what is sent as a reply and don't want Espruino polluting the response with characters like
>
for the REPL, just prefix the line with char code 16:"\x10myFunction()\n"
- Write a function on Puck.js, maybe
How am i able to communicate with the puck say from node red.
at the moment the puck is advertising events when button is pressed.
how am i able to sent a response from node red, i.e. MQTT to tell the puck to run a function on my code