I've been using building an android app to communicate with my puck over UART and that has been going quite well.
However, it is too slow and unreliable for sending large scripts.
Due to the limitations of writing to Bluetooth characteristics, I have to write them in this way (excuse the pseudo-code):
The problems with this are:
Is there a way to write these longer scripts without using the UART?
There's no better option than the BLE UART if you want to do it wirelessly. You could implement your own characteristics, but it'd be just as slow - if not more so.
The issues with writing while Puck.js is transmitting could just be a buffer overflow - if it's waiting to send data while also receiving stuff.
When you're writing code I'd definitely try doing what the IDE does though, which is to send character code 16 at the start of line for each new declaration (which disables echo for that line). You can get the espruino NPM package (the CLI tools) to output the exact characters it would have sent to a file, which might help you there.
Otherwise you can just send "echo(0)\n" before everything to totally turn echo off for all commands.
I'm afraid I'm not up to speed on the Android BLE APIs so I don't know if there's a faster way to do BLE - but I guess there must be if Web Bluetooth can do it. It might be worth looking at the sourcecode for the Nordic UART app and seeing if they do something different?
Thank you, Gordon. I didn't know about the "echo(0)\n", should come in handy.
@Gordon Just coming back to say echo (0) and prepending char(16) has been VERY helpful!
No problem - thanks for letting me know!
Guys, please send some JS code samples for learning how it works on puck.js.
Charlie at Intellijoule, Inc.
Specifically what are you after? Interfacing from Android, or just generally?
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem