3 parameters in each for loop
Cretae a function for code used more than once
count variable declared locally to where it are needed in the for loops
const byte used for LED pin numbers
Each brace on its own line to aid readability
Also, why do i need a semicolon on the count-- in last loop, but not on the count++ in the first loop?
You think you need a semicolon, but the root cause is that your for statement is incorrect. A for statement needs 3 parameters:
declaration and init
condition
update
These 3 need to be separated by a semicolon (;). For example:
for(int i = 4; i < 8; i++)
Notice that the for loop is just a shorthand for a WHILE loop:
int i = 4;
while(i < 8)
{
/* statements */
i++;
}
You don't have to specify either of the three. For example you can leave out the initialiser. When you apply this to your for loop, it becomes clear where the error is. Because count is already declared, you should have written:
3 parameters in each for loop
Cretae a function for code used more than once
count variable declared locally to where it are needed in the for loops
const byte used for LED pin numbers
Each brace on its own line to aid readability
What benefits do i gain from increasing the baud rate from 9600 to 115200?
What benefits do i gain from increasing the baud rate from 9600 to 115200?
As BL says, none in this sketch but it is the rate at which I usually set it. The important thing is that the baud rate in the program matches that of the serial device being communicated with. As there is no serial communication in this program the Serial.begin() is not even needed but I tend to put it in because of the inevitable need to print for debugging. I did not include it in the code posted but I originally had