#include "BluetoothSerial.h" BluetoothSerial SerialBT; const int analogpin = 25; const int LED = 26; int waterlevel=0; char Incoming_value = '0'; void setup() { Serial.begin(115200); Serial.println("ESP32 started"); SerialBT.begin("ESP32KEN"); //Bluetooth device name Serial.println("The device started, now you can pair it with bluetooth!"); pinMode(LED, OUTPUT); digitalWrite(LED, LOW); } void loop() { //get data from sensor waterlevel = analogRead(analogpin); if (!waterlevel){waterlevel = 0;} //char wt = waterlevel.c_str(); Serial.println(waterlevel); if (waterlevel > 500){ digitalWrite(LED, HIGH); }else{ digitalWrite(LED, LOW); } SerialBT.println(waterlevel); delay(200); }