Convert letter to floating value

Hi all,

New to forum but have a general conversion question.

I am currently reading and sending a text file in CSV format to my Arduino Duemilanove. The Arduino is then outputting it via an HC-05 Bluetooth module to an Android app serial program.

The text file consists of the following data: 1.012,2.012,3.014,4.055,5.064,6.024

My current sketch has the ability to convert the text to a number if the number was a basic integer. How would I convert it to display the entire decimal (float)? I attempted to use the double function and float but have not succeeded. Any suggestions?

Here is my current code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);
  mySerial.begin(9600);           // set up Serial library at 9600 bps
}

void loop()                       // run over and over again
{
  byte byteRead;
  
   /* check if data has been sent from the computer: */
 if (Serial.available()) {
 
 /* read the most recent byte */
 byteRead = Serial.read();
 //You have to subtract '0' from the read Byte to convert from text to a number.
 byteRead=byteRead-'0';
 
// Serial.println(byteRead);
 mySerial.println(byteRead);  
    delay(50);
  }
}

Here is my current output:

1
254
0
1
2
2
254
0
1
2
3
254
0
1
4
4
254
0
5
5
5
254
0
6
4
6
254
0
2
4

I use the function sscanf() for processing input strings. It is available in C and C++

In the Arduino development system, floating point variables are not automatically recognized. You need to link the floating point version of sscanf: http://forum.arduino.cc/index.php/topic,53894.0.html

also worth looking at is the atof() function.