Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 6 months ago.
FRDM25Z AnalogIn to LCD display problem
I want to read data from AD pin PTB0 and write the data to LCD ( I am using Andrew Lindsay's N3310LCD -http://mbed.org/search/?type=&q=Nokia+3310)
my code is lcd.writeString( 0, 1, ("%f", Dat.read()), NORMAL); I get the following error
error is "argument of type "float" is incompatible with parameter of type "char *"" in file "/main.cpp", Line: 301, Col: 27
Please help me to get over this problem.
2 Answers
10 years, 6 months ago.
Apparently they didnt inherit from Stream when making that class, so you cant use printf. writeString requires a string (char array) with the data it needs to write, that isnt done with your method. You can have a look at http://www.cplusplus.com/reference/cstdio/sprintf/
What should work is something like: (untested)
char buffer [20]; //Should be long enough buffer. sprintf (buffer, "%f", Dat.read()); lcd.writeString( 0, 1, buffer, NORMAL);