Skip to content

Instantly share code, notes, and snippets.

@jmccrohan
Created April 9, 2012 14:02
Show Gist options
  • Save jmccrohan/2343665 to your computer and use it in GitHub Desktop.
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