App inventor Nano BLE 33

Hello, I am having trouble establishing a connection with the Arduino Nano 33 BLE using the BluetoothLE1 extension. Any help would be appreciated



Okey i Will try this and let you know.

It's not working for me. It scans but nothing else. It doesn't move to the next step which is connect, even though i click on it. Nothing happens, I tried 100 times if you have an idea can you please tell me about it.


Scroll down

and you should see something like this:

Ys honey I did scroll Down but the list of BLE doesn't disappear so i don't see what you have published. Like 'if Connected get DeviceServices'. O cant click anywhere else to make the list disappear, i clicked on stop scaning it will give me once again start scaning.
Because the idea is after i choose the bluetooth i want to add labels in order to see my data on the app Invetor.

Try this one (I set ListView.Height = 25% now)

1 Like

It's working, can I please have .aia file so i can some labels to it. Please

Hello, I want to send two datas from my Arduino Nano BLE 33 to my App Inventor. I can find my BLE and but i can't connect it and receive data. Can someone please give me any suggestions?




Here are the blocks of my (test) APK (with permissions for demonstration purposes) (1)*:

(1) With the latest BLE extension BT-permissions should be requested automatically.

Okey @Anke I will try to code using your blocks and add blocks to receive data and I will let you know. And at the same time so that everyone can see if we can receive Live Data using Arduino Nano BLE 33 and App Inventor.

Here is my current blocks and my Arduino Code.
I still can see data on my phone, i can connect my Arduino nano ble 33 just fine. But i don't receive anything. Does anybody know where i have made a mistake?

#include <ArduinoBLE.h>
int NbTopsFan;         // Nombre de tours d'hélices
float Calc;            // Calculer du volume
float Q;              // Calculer du débit
int hallsensor = 2;  // PIN DIGITALE 2
int ledPin1 = 3;
int ledPin2 = 4;
int ledPin3 = 5;
int ledPin4 = 6;
int ledPin5 = 7;
BLEService dataService("19B10000-E8F2-537E-4F6C-D104768A1214"); // Random 128-bit UUID for the service
BLECharacteristic dataCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead, 20); // Random 128-bit UUID for the characteristic

void rpm() { NbTopsFan++;}

void setup() {
  Serial.begin(9600);
  pinMode(hallsensor, INPUT);
  attachInterrupt(digitalPinToInterrupt(hallsensor), rpm, RISING);
  pinMode(ledPin1, OUTPUT);   // Première Led
  pinMode(ledPin2, OUTPUT);   // Deuxième Led
  pinMode(ledPin3, OUTPUT);   // Troisième led
  pinMode(ledPin4, OUTPUT);   // Quatrième led
  pinMode(ledPin5, OUTPUT);   // Cinquième led
  if (!BLE.begin()) {
  Serial.println("Erreur BLE");
  while (1);}
  BLE.setLocalName("NanoBLE");
  BLE.setAdvertisedService(dataService); // Annoncez le service personnalisé
  dataService.addCharacteristic(dataCharacteristic); // Ajouter la caractéristique personnalisée au service
  BLE.addService(dataService); // Ajouter le service personnalisé
  // Add the BLE connection event handler here
  BLE.advertise(); // Démarrez la publicité BLE
  Serial.println("En attente de connexion BLE...");}

void loop() {
  BLEDevice central = BLE.central();
  if (central) {
    Serial.print("Connecté à : ");
    Serial.println(central.address());
    while (central.connected()) {
      NbTopsFan = 0;
      delay(1000);
      Q = (NbTopsFan / 9.5);
      Calc = (Q / 60) + Calc;
      String To_App = String(Calc, 3) + "," + String(Q, 3);
      Serial.println(To_App);
      dataCharacteristic.writeValue(To_App.c_str(), To_App.length());
      delay(200);
   if(Calc>=1){
    digitalWrite(ledPin1,LOW);
    }
  else{
    digitalWrite(ledPin1,HIGH);
    }
    
  if(Calc>5){
    digitalWrite(ledPin2,LOW);
    }
  else{
    digitalWrite(ledPin2,HIGH);
    }
    
  if(Calc>7){
    digitalWrite(ledPin3,LOW);
    }
  else{
    digitalWrite(ledPin3,HIGH);
    }
  if(Calc>8){
    digitalWrite(ledPin4,LOW);
    }
  else{
    digitalWrite(ledPin4,HIGH);
    }
  if(Calc>9){
    digitalWrite(ledPin5,LOW);
    }
  else{
    digitalWrite(ledPin5,HIGH);
   } 
   }   
    Serial.print("Déconnecté de : ");
    Serial.println(central.address());}   
}



What does this procedure do?
71433f0d9d96feaa58f4887c259c6dd17cdd808d_2_690x206

I created a function that I call everytime I scan. And it's a boolean. It works great for scanning and giving you exactly what you want. But the fact that I can't receive data it's very nerve-racking. I don't know if it's my Arduino Code or my App inventor Blocks

".... giving you exactly what you want."
And that would be?

What about showing all (relevant) blocks?

That would be scanning, once I click and boolean function is true, the listView Disappears and I get disconnect if i want to disconnect, for the moment i can't get values from Nano BL E 33 and if you have any suggestions that will be great.

Unclear, as I said

(especially this procedure)

I Showed all my blocks, I created a callback function in order to handle the data received via Arduino Nano 33 BLE. I can scan perfectly but I don't receive any data. Please Let me know if I am not clear enough.


Here are my blocks If someone wants them Or can correct how I can receive data properly



.

Android version & device name?
Did you enable Location in the device settings?

Try this and post screenshot of "Do it" result: