Created
July 11, 2017 06:25
-
-
Save stonehippo/3ec83bb6f5366e87227b562f699536a3 to your computer and use it in GitHub Desktop.
Using sprintf in Arduino code
This file contains hidden or 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
| long counter = 0; | |
| void setup() { | |
| Serial.begin(115200); | |
| } | |
| void loop() { | |
| char buffer[50]; | |
| sprintf(buffer, "The count is now %d.\n", counter++); | |
| Serial.print(buffer); | |
| delay(1000); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a dumb little sketch that shows a use of
sprintf()in an Arduino sketch. I don't recall why I wrote it, but maybe someone will find it useful.