Home

Awesome

Printf() library for Arduino

Build Status

This library redirects printf() calls to the first serial port.

Example

#include <ErriezPrintf.h>

void setup()
{
    // Initialize Serial port
    Serial.begin(115200);
    
    // Initialize printf
    printfBegin();  
    
    // Use printf() with string in RAM
    printf("Hello world with printf() string in RAM\r\n");
    
    // Use printf() with string in flash
    printf_P(PSTR("Hello world with printf() string in flash\r\n"));
    
    // Use printf() to print the variable
    int value1 = 1234;
    printf_P(PSTR("Value: %d\r\n"), value1);
}

Example output serial port Arduino UNO:

Hello world with printf() string in RAM
Hello world with printf() string in flash
Value: 1234

Library documentation

Library installation

Please refer to the Wiki page.

Other Arduino Libraries and Sketches from Erriez