I just tried an Arduino Gigi board and have been successful in loading a blink sketch in Platform IO M7 but have not been able to get the terminal to print a line using Serial.println(“start”); The program runs and blinks the LED but terminal will not print. Any suggestions?
Program is as follows:
#include <Arduino.h>
// put function declarations here:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(3000);
Serial.println("start M7");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}
I have tried that with and w/o monitor_port and monitor_speed. I have used project task"Monitor" and the Icon at the bottom to start the terminal. When I use the Arduino IDE the program works and prints as it should. Of course I would prefer to use PlatformIO to do the programming. Thanks, for your reply. John
It may just be the case that opening the serial monitor doesn’t restart the sketch. (likely done via some 1200bps reset or monitor DTR/RTS signaling?)
What happens if you continously print stuff? Does the “Upload + Monitor” task show it then?
#include <Arduino.h>
// put function declarations here:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(3000);
Serial.println("start M7");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
Serial.println("Blinky!");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}
Well , that seemed to work… The start M7 never printed but the Blinky! does print. What do you think is going on? Processor too fast and it miss the first print in setup, or the DTS/RTS signaling not initiating correctly?
Then there’s probably no “reset on serial monitor open” happening. As said, I’m not sure how this is supposed to work, but there is a standard piece of code against that:
// While no USB serial monitor connection is established, do nothing.
while(!Serial) { delay(1); }
So, if you use code like
#include <Arduino.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while(!Serial) { delay(1); }
Serial.println("start M7");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
Serial.println("Blinky!");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}
You shoud see the serial output “from the beginning”.
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(3000);
Serial.println(“start M7”);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(“Blinky!”);
first = first + 1;
Serial.println(first);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}
The terminal take 3 tries before it starts to print. FYO