-
-
-
-
-
-
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
puck.write()
. You will probably need to callload()
to get them from flash first.Also check out
Bluetooth.println()
. I seem to think that is a better function for sending your return data over BLE UART.Edited:
Bluetooth.write()
to correctBluetooth.println()
-
-
Check this thread out, I believe this user formalised some code for exactly this and shared it
http://forum.espruino.com/conversations/285086/#comment13000674
-
no direct experience with the bare module but like the Puck it needs to be in boot loader mode before the DFU is available. You don’t say if you have others that you can “flash”. The docs page on here may help if this is your only module. In the absence of a button you need to make a wired connection. I don’t know what that is but it is in the docs, I recall reading it, when I was considering the module.
-
I thought I could offer help here as I often use this
https://api.github.com/repos/:owner/:repo/releases/latest
myself to get the latest release of a repo.But it fails also.
Maybe this is to do with it being an organisation? But then tags work fine!?!
The tags JSON isn't easily sorted, I can see that. Maybe a good old fashioned web scrape of the releases page, and take the first element in the list? Not ideal.
-
Your module looks very well featured and configurable and choice is never bad.
Re tinyMQTT.js - it sets retain flag by default and some recent user contributions have (I think) addressed catching socket write fails, and stabilised reconnect functionality in general. The version on Espruino.com will be updated soon with the changes.
Beyond that, you are right, tinyMQTT support for the MQTT spec is limited.
-
-
Looks like it's still on the domain, but on "www" rather than the apex -> http://www.httptohttps.xyz/
-
Thanks Gordon. You might be able to close that issue - I tried another Puck and that was much faster. So looking into it, though I didn't specifically pair my Mac with the Puck when it was HID, it seems to have a pairing - I'd just been disconnecting it, not realising. Now, I've actually removed the pairing from my Mac, the connection seems fine. Likely a false alarm. Apologies.
-
I got some way. It's hard to develop with no console for certain.
So far:
- Connect times from IDE seem longer with 2.0.1. Puck is found quickly, but seems to take an age to connect.
- NRF connect and disconnect handlers work as expected - watched on
LED. And the iPhone reliably reconnects. - My
setRSSHandler
readings are out of range - all are positives?
- Connect times from IDE seem longer with 2.0.1. Puck is found quickly, but seems to take an age to connect.
-
-
Thanks Gordon there's loads of info to go on there - appreciated. Can I ask one more thing before cracking on with it, can the Puck drop it's HID connection? And if it does, will the pairing mean it is reestablished, or will it kill the pairing?
To be able to act on the RSSI info, I had hoped to be able to communicate with a hub of some form over BLE UART, the ideal flow would be: Detects connection of iPhone > Measures RSSI > determines RSSI is within set range as proxy for proximity > disconnect and inform hub > disconnect from hub >iphone device reconnects > repeat the previous steps? I'm very rusty on Espruino and BLE so apologies for all the questions.
-
Thanks Gordon. With the new firmware, I still had no joy, which led me to look at "clearing any pairing" as you mentioned above.
So I saved the code to the Puck (with added with E.on("init")), and reset the Puck . Now I get the pairing dialog and the media example works for me. Wonder if my Mac is at fault - not had problems before.
I'm now interested in how to detect when this iPhone connects again and if possible grab the RSSI. I've had a look about the forum and can't see how the Puck knows it is now back in control of a device via HID, nor how I can get data back such as RSSI. Are these things feasible?
-
Thanks Gordon, I'll upgrade it, I did check the Stepper video for the firmware and that was 1.94 I think. So I thought I was probably recent enough in that regard.
Also, I should add that if I'm on the Bluetooth settings screen on the iPad then I do see it when doing NRF.findDevices(print) (reporting "manufacturer": 76,, which is 0x004c - apple's ID.
Ah that's interesting, I'd recently discovered exactly the same for Wireless Networks. On later iOS the Wifi Mac address is exposed when looking for networks in the Wifi networks page, but not generally seen. I should have considered that they masked Bluetooth Mac in the same way.
Thanks again, I'll post up how I get on.
-
I've been trying to find a way to get a Puck to act as central with iPhone as peripheral. I only want the phone's RSSI, but the iPhone is invisible to my scans for it.
So I then approached it via LightBlue app which allows you to set up virtual peripherals by advertising services, but didn't have any success scanning for the device/service either.
I then saw a comment from Gordon in a related post, suggesting that HID may allow a "no software" implementation as Puck will know when peripheral is connected, but I've had absolutely zero success getting any of the HID examples to work - literally just pasting them in.
I'd concluded maybe HID was Android only - until I saw the stepper machine video which uses Puck/HID with iPad.
I paste the code, connect to Puck, upload it, disconnect, then attempt to connect from my iPhone. The device is there, it does connect, but never displays any sort of pairing modal message as is seen in the stepper video. Needless to say the functionality, say the media player control, does not work either.
The puck is running Espruino v1.96.
The iPhone is on iOS 12.1.2Is anybody seeing same, or know what I'm doing incorrectly?
-
-
Just a thought - maybe obvious to OP, maybe not. Rather than sending long commands and splitting, could wrap the control commands in functions and send to Puck from IDE and
save()
to flash. Then just callload()
from flash in the control application and call the functions. This would keep the code in the control application manageable. I'm assuming they will all fit in Puck flash which may not be case though?If anybody else uses Golang and Puck, this is the library I referred to. Tested on Mac and Raspberry Pi and I've had some joy with it.
-
I haven't used the hub stuff, but will that not work for you?
To interact with a Puck you fundamentally only need a BLE library in the language you are most familiar with. With that you can connect to and use the pucks built in UART service.
I think in Node the common one is Noble, but with any library you'd have to write code. I used a BLE library for Go sometime back and added an abstraction layer for Puck commands, including the ability to call functions. It works and might do what you need.
Another option is of course, Web Bluetooth.
Can you get a 200 response using a tool like Postman or Insomnia with the same endpoint? That's the first thing I'd check. That error suggests host is not found.
Also, but without knowing, I'd also check whether http is supported by Telegram. I would expect an API like that to use https (in which case you have a problem on ESP8266).