Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Serial.printf

  1. #1
    Member
    Join Date
    May 2014
    Location
    Black Forest Colorado
    Posts
    74

    Serial.printf

    I was looking at the serialEvent library and its example programs and I saw a

    Serial.printf("Termination Character %#02X Event fired: %s\n", Event1.rxTermCharacter, Event1.rxBuffer);

    statement. When was printf added to the Serial class? I've been including my own version in my sketches for a long time but if it is built in I no longer have to. Is this a Teensduino thing or an Arduino thing.

    Thanks

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    "%#02X"

    I've always used "%02X"

    I think Serial.printf was added by Paul.

    For code that might run on AVRs, I also tend to use the "F" macro and snprintf_P and so on to save RAM

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,676
    Quote Originally Posted by craiglindley View Post
    When was printf added to the Serial class?
    November 24, 2013:

    https://github.com/PaulStoffregen/co...6ec79ad2f61c93
    https://github.com/PaulStoffregen/co...92df6da93a891a


    Is this a Teensduino thing or an Arduino thing.
    Teensyduino only. More detailed answer is in the comments on this commit:

    https://github.com/PaulStoffregen/co...6ec79ad2f61c93

  4. #4
    Member
    Join Date
    May 2014
    Location
    Black Forest Colorado
    Posts
    74
    Excellent. Thanks for making my coding just a little easier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •