sto programmando un programma antincendio che al rilevamento di fumo fa partire le ventole e invia un messaggio ad app inventor in modo da far uscire l avviso sul applicazione.
CODICE ARDUINO
#include "BluetoothSerial.h"  
#define USE_PIN // Uncomment this to use PIN during pairing. The pin is specified on the line below
const char *pin = "1234"; // Change this to more secure PIN.
String device_name = "ESP32-BT-Slave";
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
#if !defined(CONFIG_BT_SPP_ENABLED)
#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
#endif
BluetoothSerial BT;
#define smokeSensorPin 34 // Pin analogico per il sensore di fumo MQ-2
const int buzzerPin = 5;       // Pin per il buzzer
const int ledPin = 13;          // Pin per il LED
const int fanInAPin = 14;      // Pin per l'ingresso inA del ponte H
const int fanInBPin = 27;      // Pin per l'ingresso inB del ponte H
void setup() {
  Serial.begin(115200);
  BT.begin(device_name); //Bluetooth device name
  Serial.printf("The device with name \"%s\" is started.\nNow you can pair it with Bluetooth!\n", device_name.c_str());
  #ifdef USE_PIN
    BT.setPin(pin);
    Serial.println("Using PIN");
  #endif
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(fanInAPin, OUTPUT);
  pinMode(fanInBPin, OUTPUT);
  
  Serial.begin(9600);
}
void loop() {
  // Leggi il valore dal sensore di fumo
 
  int smokeLevel = analogRead(smokeSensorPin);
  // Stampa il valore letto sulla porta seriale
  Serial.print("Livello di fumo: ");
  Serial.println(smokeLevel);
  
  // Se il livello di fumo è superiore alla soglia, attiva il buzzer, accendi il LED e fai girare la ventola in una direzione
  if (smokeLevel > 1000) {
    digitalWrite(buzzerPin, HIGH);
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
    // Attiva la ventola in una direzione
    digitalWrite(fanInAPin, HIGH);
    digitalWrite(fanInBPin, LOW);
    while (BT.available()){
     Serial.write("fumo rilevato");
    }
    }
  else {
    Serial.print("spengo");
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
    // Spegni la ventola
    digitalWrite(fanInAPin, LOW);
    digitalWrite(fanInBPin, LOW);
         while (BT.available()){
     Serial.write("fumo NON rilevato");
    }
  }
  
  // Aggiorna ogni secondo
  delay(1000);
}
translation:
I have a problem with app inventor, I've searched everywhere but I haven't found any tutorials on how to send a text from an esp32 to app inventor, can anyone help me?

