Last active
May 27, 2019 10:01
-
-
Save alistairjevans/552db05d558d07fdf31e2d0c47b6f914 to your computer and use it in GitHub Desktop.
Formatting a float into a string in arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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