Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Last active May 27, 2019 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/552db05d558d07fdf31e2d0c47b6f914 to your computer and use it in GitHub Desktop.
Save alistairjevans/552db05d558d07fdf31e2d0c47b6f914 to your computer and use it in GitHub Desktop.
Formatting a float into a string in arduino
// Arduino sprintf does not support floats or doubles.
sprintf(body, "milliseconds=%lu&speed=", timestamp);
// Use the dtostrf to append the speed.
dtostrf(speed, 2, 3, &body[strlen(body)]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment