How do I send a string using Bluetooth? I used ble101char.setValue(0x02) to send 1 value and used the same function multiple times with different values to send a string but it is too slow.
I looked at BLECharacteristics.cpp and found
BLECharacteristic::setValue(const unsigned char value[], uint16_t length).
When I tried it an error occurred.
bleTest:37: error: no matching function for call to 'BLECharCharacteristic::setValue(char [4], int)'
ble101char.setValue(dataStream,4);
The rest of my code is below. I want to know how to send a string using Bluetooth
I just figured this out last night. Use the base class, BLECharacteristic. You can provide an initial string value via the constructor (although oddly, only takes a char *, not a char * and length), and then use .setValue(char *, int len) to provide a string afterwards. Note that because this is binary data, you need to know the length of the string rather than expecting it to be zero-terminated.
Hi dekduino, does that mean you have managed to send a string over bluetooth? If possible, could you post the code you used for the arduino and whatever program you use for the receiving bluetooth side?
zwyber:
Hi dekduino, does that mean you have managed to send a string over bluetooth? If possible, could you post the code you used for the arduino and whatever program you use for the receiving bluetooth side?
Hi matiasjaure,
Did you ever manage to build a C# client to connect via BLE and receive data? would you have any code snippet in c#? It's been really hard to find a good example!
amarie:
Hi matiasjaure,
Did you ever manage to build a C# client to connect via BLE and receive data? would you have any code snippet in c#? It's been really hard to find a good example!
Thanks!
Hi Amarie, did you develop a C# app to connect via BLE and receive data?
I am trying to do that now.