Trying to get an example working with my device... #2197
Replies: 13 comments
-
Posted at 2017-04-26 by billsalt So, then I tried the compact example shown below. There is a pause, then the WEB IDE shows "Disconnected". Note: I'm using 1v92.21.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by Wilberforce in your first post, change:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by billsalt Thanks @wilberforce! The code now works (thanks for helping this NOOB), but now I'm into the second issue: it hangs and disconnects from the IDE... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by @gfwilliams I'll fix that example code... Are you using up to date firmware? You can check The one thing I notice you're doing differently is your characteristic is That shouldn't cause a crash (I'll check) but it's unlikely to work :) edit: just tested and |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by @gfwilliams Also, where did you get the second bit of code from? Did you write it yourself in ES6 syntax? I just noticed you've written |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by billsalt Thanks @gfwilliams. It appears that the 0x prefix was causing the crash. I'm using 1v92.21. Now I'm on to another issue; my device doesn't advertise services since it is a connectable iBeacon, so I'm going to have to find it using the beacon info, connect and then check for services (I believe), right? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-26 by billsalt Certainly not good enough to get the ES6 syntax. I lifted it from the NRF.findDevices documentation :-} |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by @gfwilliams And it was a crash caused by If your beacon named? You can use http://www.espruino.com/Reference#l_NRF_requestDevice to connect to a device with a certain name or start of name (namePrefix). Otherwise you're better off just using |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by billsalt Thanks @gfwilliams -- I don't think the crash was the oxff issue, it seems to have been related to the 0x prefix on the UUID's. I've actually now had the code work -- once only. It must have been in some sort of state from my trying other things, but I haven't repeated it. I'll spend some more time early next week and try to track it down better, as well as try other methods to reliably connect. The device is a connectable beacon, transmitting every 1.35 seconds, so I imagine I'm just not synching up. I'm trying extending the scan time, but so far it isn't working reliably. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by @gfwilliams You'll find that you won't be able to reliably connect at anything over about 300ms advertising interval (it depends on your connecting computer) - so it's entirely likely Puck.js was working just fine, but the advertising interval meant you couldn't connect and assumed it had crashed? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by billsalt @gfwilliams - The Web IDE running in Chrome gave the 'disconnected' message, so that would depend on whether it has a timeout. On the advertising issue: is there any way I can extend that window? I'd assumed that the timeout parameter was a scanning window, but ?? Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by @gfwilliams Ok, so yeah - if it disconnects something's gone wrong. Advertising doesn't have a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-28 by billsalt I've confused you @gfwilliams, sorry. Here's the scenario: I have my own peripheral device (eNote). It is a connectable beacon, advertising at the iBeacon maximum rate. I'm trying to scan and connect to it. I haven't yet tried it, but I believe that I can use the scan response BluetoothDevice "data" field to match its UUID and could then could connect to its "id", but I was trying scanning for its services first. I know this is unusual (connectable beacon), but there are certainly other devices like it on the market. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-25 by billsalt
I'm using the code example from the Bluetooth LE page, modified for my device:
I'm getting an error above that I think is a simple coding error, but I copied it directly. My goof, or documentation error?
Beta Was this translation helpful? Give feedback.
All reactions