# ArduinoBLE.h https://github.com/arduino-libraries/ArduinoBLE https://www.arduino.cc/reference/en/libraries/arduinoble/ BLE Keywords and intro: 1. Unable to connect with Bluetooth classic 2. Central/Periphral 3. Service/Characteristic 4. Advertise/Scanning Bord selection : Nano BLE 33 rev2(Periphral) <--> Nano IOT 33(Central) callIMU.ino <-> periphralexploere.ino ## Begeiner project : Periphral post IMU data (advertise service)on bulletin for Central reading ### Structure How to post IMU Data 1. Set periphiral device name 2. Create Service ex: IMU 3. Create Characteristic ex: ax/ay/az 4. Advertised Service 5. add Characteristic 6. add Service 7. advertise service 8. write Value ![](https://hackmd.io/_uploads/SyXvcBv_2.png) ![](https://hackmd.io/_uploads/HkyF5BwO2.png) #### !! characteristic.uuid() >> return as a string !!String a = characteristic.uuid(); ``` void exploreCharacteristic(BLECharacteristic characteristic) { // print the UUID and properties of the characteristic Serial.print("\tCharacteristic "); Serial.print(characteristic.uuid()); "String a = characteristic.uuid();" // check if the characteristic is readable if (characteristic.canRead()) { // read the characteristic value characteristic.read(); if (characteristic.valueLength() > 0) { // print out the value of the characteristic //Serial.print(characteristic.local()); Serial.print(", value : "); if((a=="0056"||a=="0055"||a=="0057")){ printCharacteristic(characteristic.value(), characteristic.valueLength()); //Serial.print('C'); }else{ printData(characteristic.value(), characteristic.valueLength()); //Serial1.println('G'); } //printCharacteristic(characteristic.value(), characteristic.valueLength());//chara only //Serial1.println(characteristic.value()); } } Serial.println(); // loop the descriptors of the characteristic and explore each /* for (int i = 0; i < characteristic.descriptorCount(); i++) { BLEDescriptor descriptor = characteristic.descriptor(i); exploreDescriptor(descriptor); }*/ } ```