Hello, I am having trouble receiving data to my appInventor. I think my code is wrong. Can someone please have a look at it and tell me if it seems wrong because i am not receiving anything in my monitor serial nor my app. It's my first time using Nano 33 BLE. #include <ArduinoBLE.h>
int NbTopsFan; // Nombre de tours d'hélices
float Calc; // Calcul du volume
float Q; // Calcul du débit
int hallsensor = 2; // PIN DIGITALE 2
BLEService bleuart("19B10010-E8F2-537E-4F6C-D104768A1214"); // UUID du service BLE UART, on crée un service
BLECharacteristic txCharacteristic("19B10010-E8F2-537E-4F6C-D104768A1214", BLEWriteWithoutResponse, 20); // UUID de la caractéristique d'écriture
void rpm() {NbTopsFan++;}
void setup() {
Serial.begin(9600);
pinMode(hallsensor, INPUT);
attachInterrupt(digitalPinToInterrupt(hallsensor), rpm, RISING);
if (!BLE.begin()) {
Serial.println("starting Bluetooth® Low Energy module failed!");
while (1);}
BLE.setLocalName("Arduino Nano BLE 33");
BLE.setAdvertisedService(bleuart); //Définit le service BLE annoncé
bleuart.addCharacteristic(txCharacteristic);
BLE.addService(bleuart);
BLE.advertise();
Serial.println("En attente de la connexion BLE...");}
I suggest you read the forum guidelines and follow them. If you do that you are likely to get much more help. Code needs to be posted in code tags. This link will get you started: How to get the best out of this forum
//BLECharacteristic txCharacteristic("19B10010-E8F2-537E-4F6C-D104768A1214", BLEWriteWithoutResponse, 20); // UUID de la caractéristique d'écriture
BLECharacteristic txCharacteristic("19B10010-E8F2-537E-4F6C-D104768A1214", BLERead, 20); // UUID de la caractéristique d'écriture
You want the central app to read the characteristic, not write to it.
With this change, using Light Blue, I can see the data output of calc and Q.
Hello, I don't receive anything in my BlueLight App. I can connect the BLE and that's it. And i only see the values in my serial monitor. And when i disconnect from the app. The serial monitor stops. I want to receive the data in my app. Can you please help me
Then press the little arrow to navigate to the screen for that characteristic. Then select the data format to be UTF-8 String and press the READ AGAIN button.