Created Fri, 03 Jan 2014 21:11:42 +0000 by kaaasap
Fri, 03 Jan 2014 21:11:42 +0000
stdlib.h line 162:
char * _EXFUN(gcvtf,(float,int,char *));
is this what I would for float to char*? The reason I ask is 4Dsystems VisiGenie requires:
genieWriteStr(index, char*)
to "print" to a string. I need to print a decimal point and tenths (0000.x).
Fri, 03 Jan 2014 21:29:38 +0000
Yep, or you can use sprintf.
void setup() {
Serial.begin(9600);
char temp[8];
gcvtf(0.348173, 4, temp);
Serial.println(temp);
sprintf(temp, "%.4f", 0.348173);
Serial.println(temp);
}
void loop() {
}
-->
0.3482
0.3482
Fri, 03 Jan 2014 21:37:59 +0000
Just after posting I tested it too.
4D's VisiGenie doesn't support sprintf unfortunately.
Hopefully, if someone searches the forums they will find this.