This applies to a waveshare ble400 board connected to a nrf51822.
I am trying to send some string from nrfConnect utility via ble. i've started from the test.ino sketch in the examples folder.
i've setup an event handler per example as below:
rxCharacteristic.setEventHandler(BLEWritten, characteristicWritten);
which is defined as below:
`void characteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
// characteristic value written event handler
msg(F("Characteristic event, writen: "));
//msgl(txCharacteristic.value(), DEC);
//msgl(txCharacteristic.value());
Serial.println(rxCharacteristic.valueLength());
strncpy(charMessage,reinterpret_cast<const char *>(rxCharacteristic.value()),rxCharacteristic.valueLength());
Serial.print(charMessage);
display.print(charMessage);
}`
If i send any data more than 2 bytes such as 4byte float, or a byte array or a text using the nrfconnect app, the event handler for characteristic written is not even called.
Maybe i am missing something but i am stuck with this problem for already quite long. Any help welcome.
Overall, my aim is to send incoming phone number as well as text messages to an OLED or a larger dot matrix display as they arrive. to achieve this another app will be running on the android phone, which will then transfer these details via ble. On the other hand, a keypad connected to the nrf51822 could be used to enter phone number which will be dialled by the phone.
Hello!
This applies to a waveshare ble400 board connected to a nrf51822.
I am trying to send some string from nrfConnect utility via ble. i've started from the test.ino sketch in the examples folder. i've setup an event handler per example as below:
rxCharacteristic.setEventHandler(BLEWritten, characteristicWritten);
which is defined as below: `void characteristicWritten(BLECentral& central, BLECharacteristic& characteristic) { // characteristic value written event handler msg(F("Characteristic event, writen: ")); //msgl(txCharacteristic.value(), DEC); //msgl(txCharacteristic.value());Serial.println(rxCharacteristic.valueLength()); strncpy(charMessage,reinterpret_cast<const char *>(rxCharacteristic.value()),rxCharacteristic.valueLength()); Serial.print(charMessage); display.print(charMessage); }` If i send any data more than 2 bytes such as 4byte float, or a byte array or a text using the nrfconnect app, the event handler for characteristic written is not even called.
Maybe i am missing something but i am stuck with this problem for already quite long. Any help welcome.
Full sketch is located here: https://github.com/iotlearner0level/bletest/blob/master/ble_app_ai2.ino
Overall, my aim is to send incoming phone number as well as text messages to an OLED or a larger dot matrix display as they arrive. to achieve this another app will be running on the android phone, which will then transfer these details via ble. On the other hand, a keypad connected to the nrf51822 could be used to enter phone number which will be dialled by the phone.