Connection with Espruino #1815
Replies: 6 comments
-
Posted at 2019-06-09 by Ollie This is a web Bluetooth page yes? Double check you are not still connected to your computer via Bluetooth, say if you have uploaded code also via the Espruino IDE. That could account for the connect disconnect logs. Puck supports one connection on the BLE UART service |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-10 by user100558 Hi Ollie, thanks for you answer. Yes, my note was connected to the puck. However, I still not figure out how to use the functions to handle the puck features. I know that I have to use Puck.write and describe the function that I wanna use in the puck and than the callback. However, I cant for example call 'Puck.on('mag',function(xyv) {' using write. Can I? I saw in examples on internet connecting through IDE that the pages call the functions of puck directly. Like
How I can use javascript like that in my code? Can I? Thanks Again |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-10 by Ollie With complex procedures to call on Puck I find wrapping them as functions and saving them on puck first, is best. Then you call the function from inside Also check out Edited: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-10 by @gfwilliams I think there might be a bit of confusion because you can run code in two places - on the Puck itself or on the PC. Unfortunately both options allow you to use functions from the But on the PC, pretty much all you can do is
You can run Take a look at the page on Web Bluetooth - it should explain most of this: https://www.espruino.com/Web+Bluetooth Specifically if you want to send a bunch of information from the Puck (like magnetometer readings) then it'd be worth looking at the last section on two-way comms: https://www.espruino.com/Web+Bluetooth#two-way-communications Instead of the light example there, using code that runs something like this on the Puck should work nicely for you:
edit: That still doesn't explain your disconnection issues though - is it possible that you actually just have a flat battery? That can often be a cause of stuff like this - there's enough charge for Puck.js to advertise, but when you connect it draws a bit more power, the voltage drops, and it resets. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-10 by Ollie Ah yes, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-10 by Robin Mon 2019.06.10
Hello @user100558, another item to consider, what version of Puck.js has been flashed? > re: 'How I can use javascript like that in my code? Can I?' Do these resources and examples aid in structuring your code?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-06-09 by user100558
Hi Guys,
I was having issues to connect with the espruino, but I was using the wrong code. So, I got how it works create my code, but now I'm receiving a return that my bluetooth is disconnected after connect. It is too weird. Do you know why?
Follow below my code and the response in chrome
Code:
Response:
Beta Was this translation helpful? Give feedback.
All reactions