I use the new iMac M1 with Arduino Uno and I am an absolute beginner....
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("Should only appear once");
}
void loop() {
// put your main code here, to run repeatedly:
}
OUTPUT ON THE MONITOR:
Should only appear onceShould only appear once
It prints twice ...
What am I missing ?
Thank you for your help.
I would change Serial.print to Serial.println to start a new line after the print. Switch on timestamp in the serial monitor. It will at least tell you how much time elapses between the two prints.
Press the reset button on the Uno and see if the same thing happens. If not then chances are it has to do with your Macs serial port or driver.
And you can add a delay(1000); before Serial.print just to see if that helps.
There is a buffer or restart or something. I have the same in linux. Someone explained it a few months ago, but I can't find that topic at the moment.
Press the reset button and it will only show once.
Upload a sketch, and you see it twice. I assume that this will be fixed in a future version of the Arduino IDE.
Some add a delay before Serial.print as Aggertroll wrote.