/*Creating an animation: repeat until all the leds in the grid have been turned on 1. Turn everything off, 2. turn on the specific led -- change frame */ int a1=2; int a2=3; int a3=4; int a4=5; int c1=6; int c2=7; int c3=8; int c4=9; int frame = 1; long timer; long timeOut = 1000; //1 second void setup() { for (int i=2; i<=9;i++) { pinMode(i,OUTPUT); } Serial.begin(9600); Serial.println("STARTED"); timer=millis(); } void loop() { if (millis()-timer >= timeOut) { //proceed with the next frame frame++; if (frame>4) { frame = 1; } timer = millis(); } if (frame == 1) { //play frame 1 playFrame1(); } else if (frame == 2) { //play frame 2 } else if (frame == 3) { //play frame 3 } else if (frame == 4) { } } void playFrame1() { off(); //top left will be c1, a1 digitalWrite(a1,HIGH); digitalWrite(c1,LOW); off(); //bottom right will be c1, a1 digitalWrite(a4,HIGH); digitalWrite(c4,LOW); } void off() { for (int i=0;i<4;i++) { digitalWrite(i+2,LOW); digitalWrite(i+6,HIGH); } }