I'd like to create a custom characteristic on a Adafruit Feather M0 Bluefruit LE. I'm using the Arduino IDE. I don't know how to get the index of the custom characteristic that I create.
I'm looking at the AT+GATTCHAR documentation which has the following code.
Code: Select all
# Clear any previous custom services/characteristics
AT+GATTCLEAR
OK
# Add a battery service (UUID = 0x180F) to the peripheral
AT+GATTADDSERVICE=UUID=0x180F
1
OK
# Add a battery measurement characteristic (UUID = 0x2A19), notify enabled
AT+GATTADDCHAR=UUID=0x2A19,PROPERTIES=0x10,MIN_LEN=1,VALUE=100
1
OK
# Read the battery measurement characteristic (index ID = 1)
AT+GATTCHAR=1
0x64
OK
# Update the battery measurement characteristic to 32 (hex 0x20)
AT+GATTCHAR=1,32
OK
When I'm writing my sketch in the Arduino IDE, I don't know how to get the result of a call to `ble.atcommand("AT+GATTADDCHAR", "UUID=0x2A19,PROPERTIES=0x10,MIN_LEN=1,VALUE=100")`. How do I read the AT command's result so that I can store the index and then use it later when I want to set the characteristic value?
Where is the documentation for `ble.atcommand`?
I already do the following in my code successfully.
Code: Select all
ble.atcommand("AT+GAPDEVNAME", MY_DEVICE_NAME);
ble.atcommand("AT+GAPSTOPADV");
ble.atcommand("AT+GAPSETADVDATA", MY_ADVERTISING_DATA);
ble.atcommand("AT+GAPSTARTADV");
Steve