Hello, I am using an mkr nano 33 ble, to send some data to my phone. I thought to use an app to display received data on my phone. The connection between is working
on nrf app , I recieved data
here is the code, it is the basic code, the interest is the application on smartphone.
#include <ArduinoBLE.h>
static const char* greeting = "50";
BLEService greetingService("180C");
BLEStringCharacteristic greetingCharacteristic("2A56",BLERead, 13); //caracteristicile mesajului
void setup() {
Serial.begin(9600);
while (!Serial);
pinMode(LED_BUILTIN, OUTPUT); // initialize the built-in LED pin
if (!BLE.begin()) {
Serial.println("Bluetooth-ul nu functioneaza");
while (1);
}
BLE.setLocalName("Nano33BLE - Disertatie"); // numele conexiunii
BLE.setAdvertisedService(greetingService);
greetingService.addCharacteristic(greetingCharacteristic);
BLE.addService(greetingService);
greetingCharacteristic.setValue(greeting);
BLE.advertise(); // Start advertising
Serial.print("Adresa MAC a dispozitivului: ");
Serial.println(BLE.address());
Serial.println("Asteptam sa se conecteze...");
}
void loop() {
BLEDevice central = BLE.central();
// conectarea cu terminalul
if (central) {
Serial.print("Adresa MAC a terminalului: ");
Serial.println(central.address());
// se aprinde ledul cand exista conexiune
digitalWrite(LED_BUILTIN, HIGH);
while (central.connected()){}
// se stinge ledul cand nu exista conexiune
digitalWrite(LED_BUILTIN, LOW);
Serial.print("Deconectat de la adresa MAC a terminalului: ");
Serial.println(central.address());
}
}
Components
Blocks:
testAPPP.aia (206.7 KB)
Isn't my app, I downloaded from the website, and tried to modify.