-
• #2
Can you try showing the message some other way? Maybe draw it to the LCD?
It's entirely likely that the
connection
message ends up being ignored because the text is received before the 'console' has swapped over to bluetooth -
• #3
Yes, many thanks, well done:
This program displays a red square when Bluetooth connects, and a blue square on disconnection. This works as expected, good.
NRF.on('connect', function(addr) { // Red square. g.setColor(255,0,0); g.fillRect(0,0,20,20); }); NRF.on('disconnect', function(reason) { // Blue square. g.setColor(0,0,255); g.fillRect(20,0,40,20); });
The following program logs "connect" and "disconnect" BLE events, while writing a dummy message in a loop.
This is tested with a Bangle2 and an Android phone ("BLE Scanner" and also "nRF Connect").
The "disconnect" event is properly detected, but not the "connect" one. However, the connection seems to be effective because "BLE Scanner" is able to read strings from the Bangle2.
Also, when connected, the writing loop is not called. Why, please ?