I am new to Arduino, though not to firmware in general.
Trying to get a basic Bluetooth LE project going. Completely new to Bluetooth. At the moment I need a single service, containing a single characteristic containing 10 bytes. As necessary I update the bytes and write the characteristic. This is not a standard profile, the other end will know what to do with the 10 bytes.
Bit confused by the Arduino BLE documentation. The basic BLECharacteristic class constructors are defined as BLECharacteristic(uuid, properties, value, valueSize), and BLECharacteristic(uuid, properties, stringValue). (No data types, I see, perhaps that is normal for Arduino?)
However, trying to use the first one gave a syntax error. Looking through the header files it seems the constructor is actually BLECharacteristic(const char* uuid, uint8_t properties, int valueSize, bool fixedLength = false); - not the same.
So:
- Is there better documentation on this anywhere?
- In the absence of better documentation, how am I supposed to do this? Am I right is assuming that I should:
Declare the service (create my own GUID)
Declare the characteristic as
BLECharacteristic mycharacteristic("UUUUUUUU-UUUU-UUUU-UUUU-UUUUUUUUUUUU", BLERead | BLENotify, 10, true);
Add the characteristic to the service, and add the service
Advertise
Then as necessary when something is connected
Update the 10 bytes
Write the characteristic using int writeValue(const uint8_t value[], int length, bool withResponse = true); (what does 'withResponse' do?)
Any helpful comments appreciated. If all this sounds a bit basic it's because I know nothing about Arduino or BLE at the moment.