These are chat archives for esp8266/Arduino

2nd
Jul 2015
Russ Mathis
@RussMathis
Jul 02 2015 15:03
Having issues with printf, sprintf formating... where can I find explanation on version/library used? I'm trying sprintf(buf,"%5.2F",3.141596); and getting ""%.2F" as the output???
Markus
@Links2004
Jul 02 2015 15:04
double is not supported
Russ Mathis
@RussMathis
Jul 02 2015 15:04
anything with decimals supported? float?
Markus
@Links2004
Jul 02 2015 15:05
yes sprintf(buf,"%s", String(3.2).c_str()); will work
Russ Mathis
@RussMathis
Jul 02 2015 15:06
How about with truncate no rounding?
guess that could be done with * 100 / 100?
Markus
@Links2004
Jul 02 2015 15:07
         String(float, unsigned char decimalPlaces = 2);
         String(double, unsigned char decimalPlaces = 2);
sprintf(buf,"%s", String(3.2, 2).c_str());
will do the rounding
Russ Mathis
@RussMathis
Jul 02 2015 15:08
ahhh, thx did'nt know about that one...
off your head, do you know of document/help for the String object used in this project?
Markus
@Links2004
Jul 02 2015 15:16
String is from arduino docu can be found here: https://www.arduino.cc/en/Reference/string