I am extremely new to programming and wanted to work with a grid which displays LEDs going from left to right along each row and down each column one at a time. I've made the circuit board and had a try at the code, however I am confusing myself. I would like to count from down from 12 to 4, but after each count I want to call a new count which counts from 4 to 0. Did I do this correctly?
// assign pins 0 through 12
int i;
int l;
// Count for P2
for(i=0;i<=4;i++); // you can't have command like this outside a function
// Count for P1
for(l=5;<=12;kl++); // ditto, also these do nothing. And what's that letter k doing there?
void setup() {
// Set pins to outputs
pinMode(i, OUTPUT): //I think these should have been inside the for-loop you attempted above. Also, that's a colon - should be a semicolon
pinMode(l, OUTPUT); // also be careful using pins 0 and 1 because they are connected to USB serial.
}
// the loop routine runs over and over again forever:
void loop() {
// First loop for P1
for(l=12,l>=8,l--); //They shouldn't be commas and you don't want that semicolon at the end
{
digitalWrite(l, HIGH);
delay(2500);
digitalWrite(l, LOW);
// The loop for P2 after each consequetive count from P1
for(i=o,i<=4,i++) //again these shouldn't be commas, and that should be a zero not a lower case O
{
digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);
}
}
}