To learn about arrays I wrote this simple sketch. It creates a 21 element array and should print out 21 pairs of lines. But I don't see why the first line does not get printed properly?
const int folderCount = 21; // Number of elements (folders)
int subtractions[folderCount] = {0, 157, 21, 154, 153, 152, 151,
49, 166, 149, 21, 206, 134, 133,
33, 127, 41, 31, 15, 114, 252
};
void setup()
{
Serial.begin(9600);
for (int i = 1 ; i <= folderCount; i++)
{
Serial.print("In folder number ");
Serial.println(i);
Serial.print("Subtract this: ");
Serial.println(subtractions[i - 1]);
delay(100);
}
}
void loop()
{
}
And when I copy paste the first few lines of output here, why does it only paste a single time stamp ?
17:12:41.691 ->
I tried a screenshot and a link, but both failed. What I wanted to show was that the text for that first line appears far over to the right.
Sorry, couldn't see the output.
Try a simple test:
I added a new print statement before the if loop.
If this prints correctly it will let you know that it is not your array causing trouble. I don't see anything obviously wrong with your print statements.
I have encountered some flakiness in the first of the output when using certain boards at one time.
I don't remember the exact details, but I think Arduino actually made a fix for it. I remember I was able to work around it by adding a short delay in setup to give a little time before the first output.
No, it's a 328. EDIT: Sorry, reckon I didn't read your question correctly. The MCU is 328, but I guess you mean the tiny square chip near the USB socket. Can't identify that.
BTW, I almost always get two identical lines at the start of any printing, directly following upload.