Hi, I am trying to send integers to Arduino Uno WiFI R2 using BLE. I can get the app connected but it does not seem to be writing anything to the characteristic. The Arduino code works when I use nRF to write the bytes. Can anyone see anything wrong with the blocks or code? Like I said, it works fine setting the characteristic values with nRF but not with these blocks.
// create service
BLEService greyService("16eb5535-ad3f-4d8b-baf4-45c0da2e104e");
/// create characteristics and allow remote device to read and write
BLEByteCharacteristic portionChar("f498c36b-0bd0-49c1-b184-3eedd5be61ca", BLERead | BLEWrite);
BLEByteCharacteristic time1hourChar("e5bbab55-8f73-467d-a764-d8b5bd8da6e3", BLERead | BLEWrite);
BLEByteCharacteristic time1minuteChar("b75b1213-ed83-4c1e-beb6-d01b8917cedf", BLERead | BLEWrite);
BLEByteCharacteristic time2hourChar("e307deb7-1e78-4eb4-88d2-daadfcca5b92", BLERead | BLEWrite);
BLEByteCharacteristic time2minuteChar("a8fc3e99-b0b1-49f0-937a-33ff49628c33", BLERead | BLEWrite);
BLEByteCharacteristic waterChar("fc1cdf91-5ad5-4d76-aa80-1fc77dbbb225", BLERead | BLEWrite);
void setup() {
// Start the I2C interface
Wire.begin();
// Start the serial interface
Serial.begin(9600);
// begin initialization
if (!BLE.begin()) {
Serial.println("starting Bluetooth® Low Energy module failed!");
while (1);
}
// set the local name peripheral advertises
BLE.setLocalName("GreyhoundFeeder");
// set the UUID for the service this peripheral advertises:
BLE.setAdvertisedService(greyService);
// add the characteristics to the service
greyService.addCharacteristic(portionChar);
greyService.addCharacteristic(time1hourChar);
greyService.addCharacteristic(time1minuteChar);
greyService.addCharacteristic(time2hourChar);
greyService.addCharacteristic(time2minuteChar);
greyService.addCharacteristic(waterChar);
// add the service
BLE.addService(greyService);
// start advertising
BLE.advertise();
digitalWrite(digitalLow, LOW);
}
void loop() {
// poll for Bluetooth® Low Energy events
BLE.poll();
DateTime now = myRTC.now();
while (Serial.available()); {
if(portionChar.value()) {
Serial.print(portionChar.value());
}