FastLED 3.10.8
Loading...
Searching...
No Matches

◆ printf()

template<typename... Args>
size_t fl::SerialPort::printf ( const char * format,
Args... args )
inline

Print formatted string to serial output (printf-style)

Template Parameters
ArgsVariadic template arguments
Parameters
formatPrintf-style format string
argsVariable arguments
Returns
Number of bytes written

Example:

fl::Serial.printf("Value: %d, Hex: 0x%X\n", 42, 255);

Note: Maximum formatted string length is 256 characters.

Definition at line 282 of file serial.h.

282 {
283 if (!format) {
284 return 0;
285 }
286
287 // Format into a fixed-size buffer using fl::snprintf
288 char buffer[256]; // Maximum formatted string length
289 int len = fl::snprintf(buffer, sizeof(buffer), format, args...);
290
291 if (len < 0) {
292 return 0; // Formatting error
293 }
294
295 // Delegate to print() method
296 return print(buffer);
297}
size_t print(const char *str) FL_NO_EXCEPT
Print string to serial output.
int snprintf(char *buffer, fl::size size, const char *format) FL_NO_EXCEPT
fl::string format(const char *fmt) FL_NO_EXCEPT
Format with no arguments.
Definition format.h:439
corkscrew_args args
Definition old.h:149

References args, fl::FL_NO_EXCEPT, fl::format(), print(), printf(), and fl::snprintf().

Referenced by printf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: