printf() function for Arduino Due


i using arduino due ide 1.5.2 eclipse juno , arduino eclipse plugin v2. trying implement relic toolkit library on due. requires printf() support. whenever trying implement below code

int serial_putchar(char c, file* f) {
    if (c == '\n') serial_putchar('\r', f);
    return serial.write(c) == 1? 0 : 1;
}

file serial_stdout;

void setup(){
    serial.begin(115200);

    // set stdout
    fdev_setup_stream(&serial_stdout, serial_putchar, null, _fdev_setup_write);[/b]
    stdout = &serial_stdout;

    printf("my favorite number %6d!", 12);
}

i error message
_fdev_setup_write' not declared in scope
symbol '_fdev_setup_write' not resolved.

can resolve issue.

your highly appreciated.

do want able define different serial devices stdout?  or hard code main usb port?

you define printf sending char usb - open usb @ baud rate in begin - serial.begin(baudrate) printf send char serial.print(c); (the file handle ignored if share code base).


Arduino Forum > Products > Arduino Due (Moderator: fabioc84) > printf() function for Arduino Due


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62