I'm attempting to get into some major code on Teensy3, which we are using to prototype a commercial product. I was not seeing serial output (a simple "blah blah test program" message) at the end of setup() so I've backed up to a really simple blink program. And even it does not work as expected.
This is on Win7 Pro 64, Arduino 1.05
I was not seeing Serial.print output when it was at the end of setup(). I'm not sure if it is OK to have Serial.print() in setup() (since it is really a constructor, right?) so I have moved it to loop() and moved the rest of my code into a while(1).
Even with the huge delay I usually don't see the one-time only Serial.print output over the Teensy3 USB in the Arduino 1.05 Serial Monitor. Sometimes, maybe 20% of the time, it is there.
The delay is there to give me time to manually open the Serial Monitor window. In an older Arduino, that would cause a reset of the module but I seem to recall that feature went away a while back.
I'm baffled. If serial output doesn't occur as expected, I worry that other things are also not executing as they should.
const uint8_t PIN = 13;
const uint16_t PERIOD = 1000; // on and off 50% of this time
const uint16_t HALF = PERIOD/2;
void setup() {
// initialize the digital pin as an output.
Serial.begin(115200); // use max baud rate
pinMode(PIN, OUTPUT);
}
void loop() {
delay(5000);
Serial.print("Blink period "); // This ouptut almost never displays!
Serial.print(PERIOD);
Serial.print(" msec on pin ");
Serial.println(PIN);
while (1)
{
digitalWrite(PIN, HIGH); // set the LED on
Serial.print(1);
delay(HALF); // wait for some msec
digitalWrite(PIN, LOW); // set the LED off
Serial.println(0);
delay(HALF); // wait for some msec
}
}
This is on Win7 Pro 64, Arduino 1.05
I was not seeing Serial.print output when it was at the end of setup(). I'm not sure if it is OK to have Serial.print() in setup() (since it is really a constructor, right?) so I have moved it to loop() and moved the rest of my code into a while(1).
Even with the huge delay I usually don't see the one-time only Serial.print output over the Teensy3 USB in the Arduino 1.05 Serial Monitor. Sometimes, maybe 20% of the time, it is there.
The delay is there to give me time to manually open the Serial Monitor window. In an older Arduino, that would cause a reset of the module but I seem to recall that feature went away a while back.
I'm baffled. If serial output doesn't occur as expected, I worry that other things are also not executing as they should.
const uint8_t PIN = 13;
const uint16_t PERIOD = 1000; // on and off 50% of this time
const uint16_t HALF = PERIOD/2;
void setup() {
// initialize the digital pin as an output.
Serial.begin(115200); // use max baud rate
pinMode(PIN, OUTPUT);
}
void loop() {
delay(5000);
Serial.print("Blink period "); // This ouptut almost never displays!
Serial.print(PERIOD);
Serial.print(" msec on pin ");
Serial.println(PIN);
while (1)
{
digitalWrite(PIN, HIGH); // set the LED on
Serial.print(1);
delay(HALF); // wait for some msec
digitalWrite(PIN, LOW); // set the LED off
Serial.println(0);
delay(HALF); // wait for some msec
}
}
Last edited: