Teensy4.0 Serialmonitor in Arduino IDE

Status
Not open for further replies.

Robib

Member
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.
 
Thanks.
I have the latest Teensyduino as i download it yesterday.
Maybe i'll just have to wait for some new release. :p
 
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
 
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.

sc.png

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);
  }

}
 
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?
 
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.
 
Status
Not open for further replies.
Back
Top