Skip to content

Instantly share code, notes, and snippets.

@jmccrohan
Created April 9, 2012 14:02
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jmccrohan/2343665 to your computer and use it in GitHub Desktop.
static float floatvar = 12345.67;
static char sprintfbuffer[15];
static char dtostrfbuffer[15];
void setup() {
sprintf(sprintfbuffer,"%f", floatvar);
dtostrf(floatvar,8, 2, dtostrfbuffer);
Serial.begin(9600);
Serial.print("sprintf: ");
Serial.println(sprintfbuffer);
Serial.print("dtostrf: ");
Serial.println(dtostrfbuffer);
}
void loop(){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment