In the API documentation there is a section on the Puck class (here: http://www.espruino.com/Reference#Puck) but it seems to be missing a lot of stuff - for instance there is nothing in there about Puck.connect?
Ahh - those are the functions that are available when running JavaScript on Puck.js itself.
Puck.connect is a command that you run in your web browser, which uses the Puck.js library. There's some information on it at http://www.espruino.com/Puck.js+Web+Bluetooth but there isn't actually a proper reference. I'll make a note to add one, but in the mean time if you look at the source there are some examples at the top, and if you scroll down to the bottom, the exported functions are there with explanation for each.
Now I would like to know its four-character Id.
The 4 character ID at the end is just the last 4 digits of the device's MAC Address.
You can get it on the Puck itself with the command NRF.getAddress().substr(-5).replace(":","") -
which takes the address in the form aa:bb:cc:dd:ee:ff, strips off the last
5 characters, and removes the colon.
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.
I'm probably a bit late to this but...
Ahh - those are the functions that are available when running JavaScript on Puck.js itself.
Puck.connect
is a command that you run in your web browser, which uses the Puck.js library. There's some information on it at http://www.espruino.com/Puck.js+Web+Bluetooth but there isn't actually a proper reference. I'll make a note to add one, but in the mean time if you look at the source there are some examples at the top, and if you scroll down to the bottom, the exported functions are there with explanation for each.The 4 character ID at the end is just the last 4 digits of the device's MAC Address.
You can get it on the Puck itself with the command
NRF.getAddress().substr(-5).replace(":","")
-which takes the address in the form
aa:bb:cc:dd:ee:ff
, strips off the last5 characters, and removes the colon.