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

Thread: Teensy 3.1 Serial.print(F(" "));

Threaded View

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    6

    Teensy 3.1 Serial.print(F(" "));

    On the usb serial for Teensy 3.1, does it still utilize the print(F(" ")) notation to free up the memory after the print action completes? I had a fairly lengthy code that printed quite a few Strings where I utilized this type of code. After about 40 minutes the code would hang up.

    My alternate approach, since most of the Strings were repeats was to create char arrays for them as global variables and just use Serial.print(char array). It seems to be working just fine now.

    Old approach:
    Serial.println(F("Data Update Requested......"));

    New approach:
    char dUpdate[] = "Data Update Requested......";

    Serial.println(dUpdate);

    I want to make sure I'm using the proper approach as I have read that there may be differences in the USB serial and hardware serial and how Serial.print() might work on each.
    Last edited by aiw; 01-05-2015 at 02:27 PM.

Posting Permissions

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