ESP32 Bluetooth send integer

Hello

I am trying to send an integer (or other typ of non 8bit number) via BT to my Android phone. But I was not successful.

Here is my ESP32 Code (shortened):

int number = 205;

void setup(void) {

SerialBT.begin("ESP32_Sensor");

}

void loop() {

SerialBT.write(number);

delay(10);

}

That is my App code:

I tried it with 1,2 and 4 ByteNumber, but no luck.
I have also tried it with SerialBT.print() but regardless of what I tried I always get a wrong number. There I have tried it with the textblock as well

Has anyone an Idea?

Thanks

Knowing what number arrived could help diagnose the problem.

Use ReceiveUnsigned1Byte blocks instead of ReceiveSigned1Byte...

You send the number 205 and it is already a negative number if you receive with a sign.

1 Like