-
Hi,
Thank you for your answer.
I don't have much knowledge of programming, so please teach me.The content of http://www.espruino.com/Web+Bluetooth looks like a sample for puck.js, such as "Puck.write".
I want to send text from my browser to bangle.js via bluetooth and have it appear on the bangle.js screen.
Currently, the browser-side program (write_test.html in the attachment) uses the bluejelly library.
On the browser side, writing from the connection works fine, but I can't figure out how to receive it on the bangle.js side.I don't know how to write "\x03\x10require("Storage").writeJSON("myapp.settings.js", "+JSON.stringify(myjsondata)+")" on my program. Is there a simple sample program?
I'm looking forward to working with you.
1 Attachment
Hi,
There's a tutorial on Web Bluetooth with Espruino devices on http://www.espruino.com/Web+Bluetooth which may help, but it sounds like you have the Web Bluetooth side sorted?
There are a bunch of tutorials for apps at https://www.espruino.com/Bangle.js#tutorials but lets say in the simplest case you have some data object you want to save to Bangle.js's memory and then load it in your app...
In your Web Bluetooth code, send some text like
"\x03\x10require("Storage").writeJSON("myapp.settings.js",{my:1,json:2,data:3})"
- you probably want the command"\x03\x10require("Storage").writeJSON("myapp.settings.js","+JSON.stringify(myjsondata)+")"
Then in the app, just use
var mydata = require("Storage").readJSON("myapp.settings.js",1);
and you can accessmydata.data
/etc