send command to Puck.JS from the raspberry without Espruino Hub install

Posted on
Page
of 2
Prev
/ 2
  • You were so close!

    It's basically the same:

    Subscribe to /ble/data/c7:f9:36:dd:b0:ca/nus/nus_rx
    Send a message to /ble/notify/c7:f9:36:dd:b0:ca/nus/nus_rx - can contain anything
    Send "\x10Bluetooth.println(E.getTemperature())\n" to /ble/write/c7:f9:36:dd:b0:ca/nus/nus_tx
    
    You should get /ble/data/c7:f9:36:dd:b0:ca/nus/nus_rx => "23\r\n"
    
  • what about the result from the function, i.e i want to send ack back .

    also i am having issue publishing on the nodered from another lan machine

  • maybe i should rephrase my last message,

    what is the best way to execute a function within the puck and get a response

  • Any function with a return will give you a response to console. So will Bluetooth.println as per Gordon's post not both execute the function and send the returned response? That's the behaviour I would expect.

  • Yes - instead of "\x10Bluetooth.println(E.getTemperature())\n" just do "\x10Bluetooth.println(yourfunction())\n"

    It's all basically just the same as I'd explained earlier when you were trying with Python

  • thanks, so i have tried the following and it works but i do receive an echo of the input command. so i tried with the \x10, but this does not work, however i receive the following echoed back.

    when issuing the following command

    "beam(sleep)\n"
    

    i get

    {"topic":"/ble/data/d8:19:e7:5b:3a:57/nus/nus_rx","payload":"beam(sleep)\r\n","qos":0,"retain":false,"_msgid":"2846d788.245218"}

    and

    {"topic":"/ble/data/d8:19:e7:5b:3a:57/nus/nus_rx","payload":"=\"testing\"\r\n>","qos":0,"retain":false,"_msgid":"37141196.ec66fe"}

    however when issuing the following command to rid of the echoed command

    "\x10beam(sleep)\n"
    

    i only get

    {"topic":"/ble/data/d8:19:e7:5b:3a:57/nus/nus_rx","payload":"\"\x10beam(sleep)\n\"","qos":0,"retain":false,"_msgid":"7217a5c4.d44c8c"}

  • the following seems to works. all good thanks

    \x10Bluetooth.println(beam(mycool))\n

  • In case anyone needs it, the Python code to transmit and receive is now at:

    http://www.espruino.com/Interfacing#python

    As is code in Node.js

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

send command to Puck.JS from the raspberry without Espruino Hub install

Posted by Avatar for Ossama @Ossama

Actions