- Wed May 05, 2010 2:21 am
#100140
OK... I am pulling my hair out trying to display a simple float value on my SerialLCD screen...!
I'm using one of the SparkFunSerLCD libraries (downloaded from http://www.arduino.cc/playground/Code/SfLCD]). It has an "at" function which is overloaded with many types (besides float!)... It basically calls the "pos" function, and then immediately the "print" function from the SoftwareSerial library.
So I need to convert my float to a string (or array of chars, correct?). Here is my snippet.
float test = 123.45;
char temp[10];
snprintf(temp, 9, "%f", test);
lcd.at(1,1, temp);
It results in a question mark (?) in the first row, first character... I have tried several formatting strings, to no avail. Am I missing something? I wish there was a .ToString() function!!!
Keith
I'm using one of the SparkFunSerLCD libraries (downloaded from http://www.arduino.cc/playground/Code/SfLCD]). It has an "at" function which is overloaded with many types (besides float!)... It basically calls the "pos" function, and then immediately the "print" function from the SoftwareSerial library.
So I need to convert my float to a string (or array of chars, correct?). Here is my snippet.
float test = 123.45;
char temp[10];
snprintf(temp, 9, "%f", test);
lcd.at(1,1, temp);
It results in a question mark (?) in the first row, first character... I have tried several formatting strings, to no avail. Am I missing something? I wish there was a .ToString() function!!!
Keith