bluetooth serial query

Hi, i'm using the SoftwareSerial library, a bluetooth JY-MCU connection feeding AT commands into an Atmega328. I have successfully connected this all up so that using BlueTerm on my android handset I can set the colour of a RGB LED attached to my Atmega328 by sending the characters r, g or b from the android handset. I have implemented a return path where the character s is sent from android handset, in return the arduino replys with either r, g or b so the state of the RGB LED can be read.

So far this is all working very well sending 1 ascii character at a time using BluetoothSerial.read(); and BluetoothSerial.write(LEDstate + '0');. I now want to send a float (from DS18B20 temperature sensor) through, please can someone point me in the right direction to do this, I am thinking that I need to separate each digit of the float, including the '.', and send one after the other as ascii characters, how do I do this?

Thank you for your help,

Craig

I am thinking that I need to separate each digit of the float, including the '.', and send one after the other as ascii characters, how do I do this?

Why do you think you need to? SoftwareSerial derives from Stream which drives from Print, which in addition to write() methods, has print() methods which know how to convert a float to a string to be sent.

craigdiver:
I now want to send a float (from DS18B20 temperature sensor) through, please can someone point me in the right direction to do this, I am thinking that I need to separate each digit of the float, including the '.', and send one after the other as ascii characters, how do I do this?

Maybe BlueTerm has some special requirement which I haven't found, but I don't think you need any of that stuff. Once you have established the connection, which you already have, you just use

Serial.print(tempC);

commands, where tempC is a plain vanilla float 25.62, and the data goes out on bluetooth.

PaulS:
Why do you think you need to? SoftwareSerial derives from Stream which drives from Print, which in addition to write() methods, has print() methods which know how to convert a float to a string to be sent.

Thank you so much PaulS, BluetoothSerial.print(temperature);
works perfectly.