So just getting started, and I wrote a program that almost does what I want:
int counter = 0;
int blinker = 1;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// initialise built-in LED pin as output
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Hello #");
Serial.println(counter);
counter += 1;
Serial.println("incremented");
// blink the LED
for (int i = 0; i < blinker; i++) {
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
blinker += 1;
if (blinker > 5) {
blinker = 0;
}
delay(1000);
}
It should print increasing values to the serial port, and flash the LED 1 through 5 times. And it does all that, exactly as I want, except the first time:
Ask a silly question, but have you clear the contents of the serial monitor everytime in all tests?
With the serial monitor open, remove the Arduino from the USB.
And press the clear button on the serial monitor to blank out the recent contents.
What text displayed when you plug the Arduino into USB again?
In my environment (Mac Pro) a sketch on my UNO will run for about 180 milliseconds after upload and before Serial Monitor connects and cause a reset. I have taken to adding a 200 millisecond delay after Serial.begin().
Note: At 9600 baud the serial output generated before Serial Monitor connects and causes a reset is readable. At other baud rates the text before the reset shows up garbled.