BLE connection from my windows pc to the bangle js 2 #5760
Replies: 1 comment
-
Posted at 2023-01-24 by @gfwilliams Hi - if you connect to the BLE UART service (which I think is what you might be doing?) then by default you're sharing it with the JavaScript REPL. The simplest method is just to wrap what you send in a function call. For instance if you send the string OR you can handle data coming in with Or you could create another characteristic - but using the BLE UART is nice and easy Posted at 2023-01-24 by Riccardokhm Hi! Thanks for your prompt repyl: where can I find reference to the
method? I couldn't find anything on the doc. Anyway, regarding the first method, do you think this is correct in my c# console? This is just a test:
Posted at 2023-01-24 by @fanoush the Posted at 2023-01-25 by @gfwilliams It's at http://www.espruino.com/Reference#l_Serial_data - Bluetooth is an instance of I think you have two issues here...
Posted at 2023-01-26 by Riccardokhm Hi,
and test as you suggest!
Is Bluetooth.on() called once the BLE received packets ? Posted at 2023-01-27 by @gfwilliams Ahh - maybe you could try what I suggested at the start first? Just a function called 'X'?
Try adding Posted at 2023-01-27 by Riccardokhm No actually I didn't call the E.setConsole(), I'll try even if I'd like to keep the console on my logic to double check the response. As for your first suggestion, did you mean to implement a callback function 'X' which will accept the data sent as parametr and which is call when something is received? Basically adding this function within Bluetooth.on()? Posted at 2023-01-27 by @gfwilliams
If you don't call
No... I mean just code like this:
Posted at 2023-01-30 by Riccardokhm I tried but anyway the connection print the data received to my C# console and not the bangle. I tried even by deactivating the console with the code below, same results:
this is instead the C# console class:
Any other suggestion? Posted at 2023-02-01 by @gfwilliams Do Otherwise when BLE connects the console swap over to BLE automatically. You can do Posted at 2023-02-08 by Riccardokhm Tried but nothing! I am thinking of creating a new service on my PC to which connect the Bangle Js. I did not find any other valid solution to the topic. Actually the message is sent to my PC, but the Bangle seems not to be receiving it. Posted at 2023-02-09 by @gfwilliams I don't know if maybe you can try using NRF Connect on your phone to emulate the Bangle.js UART service, and then you'd be able to see if your code on the PC is working properly? Posted at 2023-02-10 by Riccardokhm Just to know, which is the protocol type of the BLE module running on the Bangle Js 2? 5.2? Because on my laptop I am running BLE 4.0. Posted at 2023-02-10 by @fanoush It is something between 5.0 and 5.1, doesn't matter much, should just work with4.0. Current firmware is using S140 6.0.0 as per https://www.nordicsemi.com/Products/Development-software/S140 , qualification for 5.1 was passed in version 7.0.1 Posted at 2023-02-13 by Riccardokhm Ok i successfully managed to trigger the X.on("data"...) event, but it is not evoked when I tried to send again another message.
Does the function(d) return a dataview? Posted at 2023-02-22 by @gfwilliams On the case of Posted at 2023-03-03 by Riccardokhm Clear! Thanks you! What about if I'd like reading bytes or int16 data sent over ble to my bangle? Posted at 2023-03-06 by @gfwilliams If you send binary data to Bangle.js over the UART connection, you can just read that out with The event returns a string, but it's easy enough to use E.toUint8Array: http://www.espruino.com/Reference#l_E_toUint8Array
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-01-24 by Riccardokhm
Hi there,
I am implementing a BLE connection between my pc and the Bangle js 2 to stream data from the Bangle to the pc and send back responses to the bangle. I successfully managed to connect the two devices (the bangle is acting as a server device streaming the data I need to a C# console), but I'd like to send back a response string. Data is wrapped in my C# and sent to the bangle but I cannot find a way to read it on the device: do I need to create a specific characteristic on my pc to which connect the bangle or am I missing something? Connection actually is successfull but is it biunivocal?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions