ESP32 cansat next: Difference between revisions
From wikiluntti
(Created page with "== Introduction == Some interesting coding stuff == snprintf == printf, print Each ASCII character takes 1 byte. You can store exactly 128 ASCII characters in the above char array. <syntaxhighlight lang="C"> char report[128]; memset(report, 0, sizeof(report)); snprintf(report, sizeof(report), "%4.2f, %4.2f, %4.2f, %4.2f, %4.2f, %4.2f", ax, ay, az, gx, gy, gz); Serial.println(report); </syntaxhighlight>") |
|||
Line 16: | Line 16: | ||
Serial.println(report); | Serial.println(report); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Radio == | |||
== SD Card == |
Revision as of 18:31, 23 March 2025
Introduction
Some interesting coding stuff
snprintf
printf, print
Each ASCII character takes 1 byte. You can store exactly 128 ASCII characters in the above char array.
char report[128];
memset(report, 0, sizeof(report));
snprintf(report, sizeof(report), "%4.2f, %4.2f, %4.2f, %4.2f, %4.2f, %4.2f",
ax, ay, az, gx, gy, gz);
Serial.println(report);