// LED light running back and forth using arrays function and
// direct registers access.
// Created by kidkara
int ledarrayD[15]{B00000100,B00000000,B00001000,B00000000,B00010000,B00000000,B00100000,
B00000000,B01000000,B00000000,B10000000,B00000000,B00000000,B00000000,
B00000000};
int ledarrayB[15]{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000000,
B00000010};
void setup() {
DDRD=B11111100;
DDRB=B00000011;
}
void loop() {
for(int i=0; i<14; i++)
{
PORTD=ledarrayD[i];
PORTB=ledarrayB[i];
delay(60);
}
for(int i=14; i>0; i--)
{
PORTD=ledarrayD[i];
PORTB=ledarrayB[i];
delay(60);
}
}