Reputation: 319
While working on a project, I found out that the Arduino Serial Monitor was printing the output of the setup()
function twice.
So, in order to test what was actually happening, I tried it out with the following sample code:
const uint16_t MOD = 150;
const uint16_t val = 53314;
const uint16_t m = 30;
static uint16_t count = 0;
void setup() {
uint16_t A[m][m];
Serial.begin(9600);
for (int i=0; i<m; i++) {
for (int j=0; j<m; j++) {
A[i][j] = val % MOD;
}
}
Serial.println("DONE");
Serial.println(A[0][0]);
count++;
Serial.println(count);
}
void loop() {}
And found out that every time I upload the code to Arduino it prints the setup()
output twice.
Can someone please provide an explanation as to why this is occurring?
The configuration of the system that I am using to upload the code:
And, I am using an Arduino UNO board.
Upvotes: 0
Views: 1577
Reputation: 11
Even a delay of 200ms worked for me. Any Lower and I have double prints
Upvotes: 1