Advertise Mag reading when button pushed #2155
Replies: 8 comments
-
Posted at 2017-02-15 by @gfwilliams There isn't, but try:
That should pack the magnetometer data into 6 bytes that you could then read. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-15 by Terrence Thank you for the code sample, I will put it into place tonight. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-24 by user73560 Hi Gordon, On Puck we have: [-21, -5126,5,1289, -3,-747] How can we obtain the advertised mag values ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-24 by @gfwilliams In JavaScript? It seems I got the endianness wrong, so you can't just do: Instead you need:
I guess you're using Java in Android - that code should be pretty easy to convert. There are other ways of converting numbers from byte arrays (utilities in various different languages), but the code above is pretty universal. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-25 by user73560 Hi Gordon, Thank you for your answer. Yes, one way of getting the data on Android is:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by Tineler Hi @gfwilliams How did you test the advertising? I'm trying to test it using a WiPy and the nRF connect app, but I don't see any data. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by @gfwilliams Personally I use the NRF Connect app to scan for advertising data. You're trying to scan for advertising data that's coming from a Puck.js? Are you disconnected from the Puck.js? Puck.js (like most BLE devices) will only advertise when there is no device with an active BLE connection to it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-27 by Tineler Yes, I'm trying to scan for advertising data that's coming from my Puck.js. I indeed had a Bluetooth connection open (for the IDE). Thank you! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-15 by Terrence
Is there a tutorial, that I can't find, that shows code to advertise the magnetometer values in a characteristic when the button is pushed?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions