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

Thread: Teensy4.0 Serialmonitor in Arduino IDE

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    5

    Teensy4.0 Serialmonitor in Arduino IDE

    Hello.

    I've just got my Teensy4.0 and done some testing-
    Now i have this little problem:
    I'm using Arduino IDE 1.8.9. I did upload a simple sketch, LED blink with serial read out.
    But i don't get any text in the serial monitor.
    I have tried with COMport setting: Port 3. Windowbar shows: TeensyMonitor COM3 Online.
    Also: COMport 3 Serial (Teensy4.0). Window bar shows: COM3 (Teensy) Serial.
    I also tried with several different baudrates(9600, 19200, 38400, 115200).

    Code:
    unsigned long prevTime = 0;
    const long interval = 2000;
    int state = LOW;
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      Serial.println("TEST Analog");
      pinMode(out, OUTPUT);
      digitalWrite(out, LOW);
      //Serial.println("TEST 1");
    }
    
    void loop() {
    //   put your main code here, to run repeatedly:
      unsigned long curTime = millis();
      if (curTime - prevTime >= interval) {
        prevTime = millis();
        if (state == LOW) {
          state = HIGH;
        } else {
          state = LOW;
        }
        Serial.print("state ");
        Serial.println(state);
        digitalWrite(out, state);
      }
    
    }
    So do is there someone that can tell my how to get serial monitor to work?
    In advance, thank you.

  2. #2
    you might need to use latest teensyduino,
    https://www.pjrc.com/teensy/td_download.html

    also, there are some ongoing improvements to the serial monitor. i think discussion is in 4.0 beta thread.

  3. #3
    Junior Member
    Join Date
    Jul 2019
    Posts
    5
    Thanks.
    I have the latest Teensyduino as i download it yesterday.
    Maybe i'll just have to wait for some new release.

  4. #4
    take a look at this thread that discusses some serial monitor issues and a few fixes.
    https://forum.pjrc.com/threads/54711...l=1#post213526

  5. #5
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,171
    When I added this statement to your code:
    Code:
    const uint8_t out = LED_BUILTIN;
    it works. Teensy 4(beta 2) with current Arduino and Teensyduino on Windows 10.

    Pete

  6. #6
    Junior Member
    Join Date
    Jul 2019
    Posts
    5
    I don't know why, but there no change....

  7. #7
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,171
    Does it toggle the LED every two seconds?

    Pete

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,753
    Indeed, as Pete said, your program doesn't compile. I added that line and it's working here on a Teensy 4.0. Here's a screenshot of the serial monitor with it running.

    Click image for larger version. 

Name:	sc.png 
Views:	3 
Size:	27.5 KB 
ID:	17344

    Here is a complete copy of the working code:

    Code:
    unsigned long prevTime = 0;
    const long interval = 2000;
    int state = LOW;
    const uint8_t out = LED_BUILTIN;
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      Serial.println("TEST Analog");
      pinMode(out, OUTPUT);
      digitalWrite(out, LOW);
      //Serial.println("TEST 1");
    }
    
    void loop() {
    //   put your main code here, to run repeatedly:
      unsigned long curTime = millis();
      if (curTime - prevTime >= interval) {
        prevTime = millis();
        if (state == LOW) {
          state = HIGH;
        } else {
          state = LOW;
        }
        Serial.print("state ");
        Serial.println(state);
        digitalWrite(out, state);
      }
    
    }

  9. #9
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    677
    The original code not compiling seems like a clue that the code running on the OP's T4 is not what is listed; possibly it is still the original blink sketch?

  10. #10
    Junior Member
    Join Date
    Jul 2019
    Posts
    5
    Yes it do.
    I also had another sketch and that's working to except from the serial readout.

  11. #11
    Junior Member
    Join Date
    Jul 2019
    Posts
    5
    No its not the original blink sketch.
    I can change the interval and it changes to.
    i have been running at least different 3 different sketches.
    So it is compiling and uploading the sketch.
    I have also tried the "Serial" from "examples - teensy" and there is no readout in the serial monitor.

Posting Permissions

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