Closed Davidffry closed 4 years ago
Hi @Davidffry ,
the arduino sketch is fine.
Are you opening the Serial monitor after uploading the code on the mkr1010?
With this statement: while (!Serial);
the board will wait until you open the Serial communication.
If you want to use the board without Serial monitor, just remove such statement from the sketch.
I try to write with my MIT innovate app to the MKR 1010 Arduino and somewhere I've an issue: the writing doesn't works.
I add characteristics (BLERead | BLEWrite) on the services and show the count services I've 0 charateristics display.
I think this is the issue. this is the code : (use the led exemple) `
include
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // BLE LED Service
// BLE LED Switch Characteristic - custom 128-bit UUID, read and writable by central BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
const int ledPin = LED_BUILTIN; // pin to use for the LED
void setup() { Serial.begin(9600); while (!Serial);
// set LED pin to output mode pinMode(ledPin, OUTPUT);
// begin initialization if (!BLE.begin()) { Serial.println("starting BLE failed!");
}
// set advertised local name and service UUID: BLE.setLocalName("LED"); BLE.setAdvertisedService(ledService);
// add the characteristic to the service ledService.addCharacteristic(switchCharacteristic);
// add service BLE.addService(ledService);
// set the initial value for the characeristic: switchCharacteristic.writeValue(0);
// start advertising BLE.advertise();
Serial.println("BLE LED Peripheral"); }
void loop() { // listen for BLE peripherals to connect: BLEDevice central = BLE.central();
// if a central is connected to peripheral: if (central) { Serial.print("Connected to central: "); // print the central's MAC address: Serial.println(central.address());
} }`
and my MIT invetor app :