Receive type:doubles with ESP32 Bluetooth

I am using an ESP32 and would like the device to receive a number. I have sent the number 32.44 to the device but when I output it to the serial monitor it is not correct. What am I doing wrong?

The serial monitor output is:
16:05:56.837 -> 51.00
16:05:56.837 -> 50.00
16:05:56.837 -> 46.00
16:05:56.837 -> 52.00
16:05:56.837 -> 52.00
16:05:56.837 -> 13.00

Here is the code:

#include "BluetoothSerial.h"
 
BluetoothSerial SerialBT;

double count = 0;
 
void setup() {
  Serial.begin(115200);
 
  if(!SerialBT.begin("ESP32")){
    Serial.println("An error occurred initializing Bluetooth");
  }
}
 
void loop() {
 
  while(SerialBT.available()){
    count = SerialBT.read();
    Serial.print(count);
    Serial.println();
  }
 
  delay(50);
}

This reads a single character and interprets it as a float value.

See this tutorial: Serial Input Basics - updated

Thanks, I figured it out.

You can mark your topic as solved by clicking the solution button under the most usefull reply.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.