DroidScript with Puck.Js

100 views
Skip to first unread message

Francois Martin

unread,
Apr 30, 2019, 4:32:13 AM4/30/19
to DroidScript
Hi,
I've been asked to do a small app receiving and sending data from and to a puck.js. 
The thing is that I've able to send data to the puck.js using puck.SendCode(). Unfortunatly, I can't receive data from the puck using the same method. It's written on the doc that it's possible to "receive the console output of your Puck programs to get information back to your app". 
Therefore, my question is how can I get that information back ?
Thanks a lot,
Have a great day.

Dave

unread,
May 3, 2019, 8:57:06 AM5/3/19
to androi...@googlegroups.com
You might find the more general BLE plugin easier to use for serial UART type communications, however:-

You should also be able do basic serial comms with the puck by using the puck.Send( msg ) function and receiving data by setting a callback using the puck.SetOnReceive( callback ) to receive console.log messages coming back from the puck.

Note1: If you do this, then you cannot use any of the other puck data reading functions such as puck.SetOnButton() because using them would steal the receive callback from you.  You will also need to program the puck manually to send console.log messages.

Note2: The plugin expects \n characters at the end of each console.log message. Examining the PuckJs.inc file might shed some light on the way it works



Reply all
Reply to author
Forward
0 new messages