I'm currently trying to send data from esp32 to my android app that I made. The sensor readings are showing in the serial monitor, however, what's showing on my app are either @ or &. Please help and thank you. I'm new to bluetooth coding.
Here's the code:
#include "BluetoothSerial.h"
int sensorPin = 35;
int sensorreading;
BluetoothSerial SerialBT;
void setup ()
{
Serial.begin(115200);
SerialBT.begin("ESP32_ABO");
pinMode (sensorPin, INPUT);
}
void loop ()
{
sensorreading = analogRead(sensorPin);
String toSend = String (sensorreading);
sendData(toSend);}
void sendData(String textToSend){
Serial.print(sensorreading); SerialBT.write(textToSend[sensorreading]); } delay(1000);}
#include "BluetoothSerial.h"
int sensorPin = 35;
int sensorreading;
BluetoothSerial SerialBT;
void setup ()
{
Serial.begin(115200);
SerialBT.begin("ESP32_ABO");
pinMode (sensorPin, INPUT);
}
void loop ()
{
sensorreading = analogRead(sensorPin);
String toSend = String (sensorreading);
sendData(toSend);}
void sendData(String textToSend){
Serial.print(sensorreading);
SerialBT.write(textToSend[sensorreading]);
}
delay(1000);}