Hi Gordon, Thanks for the quick reply. I eventually worked it out. I want to get some data in real time from a Bangle app onto the android screen.
In Droidscript
// Connect to Bangle
puck = app.CreatePuckJS();
puck.SetOnReceive( readResponse ); // Callback to capture console output from app.
puck.Scan("Bangle");
The callback function something like :
function readResponse(data) {
if ( data.substring(0,1) != '{' ) return; // ignore non JSON
d = JSON.parse(data);
// Do something with the data in array d
}
In the Bangle app the dat array is sent as a JSON string :
function btSend(dat) {
// console.log(JSON.stringify(dat)); // transmit the data
Bluetooth.println(JSON.stringify(dat)); // transmit the data
}
It will all be published in the 'GPS Adventure Sports II' Bangle app soon.
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 Gordon, Thanks for the quick reply. I eventually worked it out. I want to get some data in real time from a Bangle app onto the android screen.
In Droidscript
The callback function something like :
In the Bangle app the dat array is sent as a JSON string :
It will all be published in the 'GPS Adventure Sports II' Bangle app soon.