Thursday 18 September 2014

Arduino: Convert String to float.

char floatbuf[32]; // make this at least big enough for the whole string
curLongitude.toCharArray(floatbuf, sizeof(floatbuf));
float f = atof(floatbuf);

source:
http://stackoverflow.com/questions/18200035/how-do-you-convert-a-string-to-a-float-or-int

No comments:

Post a Comment