Programming puck using native android app code. #2158
Replies: 8 comments
-
Posted at 2017-04-25 by @gfwilliams Yes, that's not a problem at all. There some 'Nordic UART' example code for Android provided by Nordic Semiconductor (or you can just do it yourself by writing to the Nordic UART bluetooth characteristics). You can just connect, and then write JavaScript code straight to the Bluetooth UART. It'll then be executed after a newline. There's a very rough example here using Web Bluetooth: http://www.espruino.com/Puck.js+Web+Bluetooth#two-way-communications In that example, when connected, it calls If you have other questions about it don't hesitate to ask though! (edit: just moving this to the Puck.js forum) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-25 by Harry Thanks @gfwilliams let me try this :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by Harry @gfwilliams I was able to connect to device. And it works for one command. But i am not able to send a complete script. Can you share me some sample if possible how to pass the data to device in complex code. I have 100 +line of js. What is the best way to send data. When i write this code to puck it didn't do anything |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by @gfwilliams Ahh, ok. Your problem could be that by default Espruino is acting as a normal command-line interface. It 'echo's the characters you send it back to you, and that could be causing buffering problems since it may be trying to send more characters to you than you are to it. One way to debug would be to make sure you set notifications on the RX characteristic, and dump the data you receive back from Puck.js somewhere so you can see if you get any errors. You can either send The other easy solution to this is to run your code through the Espruino command-line tools: https://www.npmjs.com/package/espruino If you do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by Harry Thanks @gfwilliams but didn't get much help with above code. when i write the code the device line by line it start executing the code. if complete code is written in single step then nothing happens. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by @gfwilliams Do you think you can give me a short example of what you're sending, what's happening, and what you expect to happen? Usually when you send code to Espruino (for instance via the Web IDE) it is executed as it is uploaded. If you don't want it to execute then you put the code inside a function, and then you call that function when you need the code executed. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by Harry Thanks @gfwilliams i got the issue was the amount of data sent to device. I have read android documentation that it allows 20bytes as MTU which was the issues in my case i have broken the code into chunks and send it to device and it worked (y) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by @gfwilliams Great! Thanks for letting us know how you got it sorted! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-04-25 by Harry
Hi All,
We are having some requirement of using the android app(Native). Is it possible to write the js code on puckjs device using the android native app on first configuration. Please help us .
Thanks
Harminder Singh
Beta Was this translation helpful? Give feedback.
All reactions