nikwon
Published © GPL3+

4in1 Light Show

4 light shows in one. Create four different sequences of light patterns with only an UNO.

BeginnerFull instructions provided270
4in1 Light Show

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Any board will work as long as it has enough pins and memory.
×1
5 mm LED: Yellow
5 mm LED: Yellow
It's advised that each row gets its own color, but this advise is unnecessary.
×4
LED (generic)
LED (generic)
It's advised that each row gets its own color, but this advise is unnecessary.
×4
5 mm LED: Green
5 mm LED: Green
It's advised that each row gets its own color, but this advise is unnecessary.
×4
LED, Blue Green
LED, Blue Green
It's advised that each row gets its own color, but this advise is unnecessary.
×4
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
The buttons are needed for inputs.
×4
Buzzer
Buzzer
Optional. Make sure it's passive, not active.
×1
Breadboard (generic)
Breadboard (generic)
400 points (half-sized) is the minimum.
×1
Jumper wires (generic)
Jumper wires (generic)
For the connections.
×1
USB-A to B Cable
USB-A to B Cable
For uploading the code.
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic

Open this file in Fritzing.

Schematic

Open this file in Fritzing.

Schematic

Schematic

Code

Code

C/C++
/*
 The following code is not professional. 
 It is nor efficient.
 The layout is not surely, it is meant to randomize light shows without "random()."
 It still works, however, it MAY not suit an @tiny due to the plus amount of memory it uses. 
 It takes up around 38% of a normal Arduino UNO rev3.
 The reason for this is that this code uses 1058 lines of code, most in which are very short.
 */
//__________________________________r1
int ROWonestate= 0; //State of pin: 0 = off, 1 = on
int ROWonepin = 2; 
int ROWonebuttonPin = 12; //The pin for the button
int ROWonebuttonNew; //Undefined, will be defined later
int ROWonebuttonOld = 1; //Old button, sitting at 1111...
//___________________________________r2
int ROWtwostate= 0;
int ROWtwopin = 3;
int ROWtwobuttonPin = 11;
int ROWtwobuttonNew;
int ROWtwobuttonOld = 1;
//__________________________________r3
int ROWthreestate= 0;
int ROWthreepin= 4;
int ROWthreebuttonPin = 10;
int ROWthreebuttonNew;
int ROWthreebuttonOld = 1;
//__________________________________r4
int ROWfourstate= 0;
int ROWfourpin= 5;
int ROWfourbuttonPin = 9;
int ROWfourbuttonNew;
int ROWfourbuttonOld = 1;
//_____________________________________extra
int dt = 150;
int buzzer = 13;
void setup(){ //Start setup
  Serial.begin(9600);
  pinMode(ROWonepin, OUTPUT);
  pinMode(ROWonebuttonPin, INPUT);
  pinMode(ROWtwopin, OUTPUT);
  pinMode(ROWtwobuttonPin, INPUT);
  pinMode(ROWthreepin, OUTPUT);
  pinMode(ROWthreebuttonPin, INPUT);
  pinMode(ROWfourpin, OUTPUT);
  pinMode(ROWfourbuttonPin, INPUT);

}
void loop(){//the code:
 ROWonebuttonNew = digitalRead(ROWonebuttonPin); //Make buttonNew = buttonPin ~read
 if (ROWonebuttonOld == 0 && ROWonebuttonNew == 1){//if statements with specific conditions 
  if (ROWonestate == 0){ //Start an if, LED state is already off. When-changed, give "HIGH"/1 to ROW
    Serial.println("Sequence 1 has been activated.");
    Serial.println("Sequence 1 is in action.");
digitalWrite(2, 1);
tone(13, 1200);
delay(150);
tone(13, 2000);
digitalWrite(3, 1);
delay(150);
tone(13, 600);
digitalWrite(5, 1);
delay(150);
tone(13, 200);
digitalWrite(4, 1);
delay(150);
tone(13, 1200);
digitalWrite(5, 0);
delay(150);
digitalWrite(2, 0);
digitalWrite(5, 1);
tone(13, 600);
delay(150);
digitalWrite(4, 1);
tone(13, 200);
delay(150);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13, 900);
delay(150);
digitalWrite(5, 0);
digitalWrite(3,0);
tone(13, 400);
delay(150);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(5,1);
tone(13, 1200);
delay(500);
digitalWrite(2,0);
tone(13,200);
delay(150);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13,600);
delay(150);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13,900);
delay(150);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13,300);
delay(150);
digitalWrite(4,0);
digitalWrite(5,1);
tone(13,700);
delay(150);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13,200);
delay(150);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13,1200);
delay(150);
digitalWrite(2,1);
tone(13,400);
delay(500);
tone(13, 1200);
digitalWrite(4,0);
digitalWrite(5,0);
delay(150);
tone(13,600);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,1);
digitalWrite(5,1);
delay(150);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,0);
digitalWrite(5,0);
tone(13, 1200);
delay(150);
tone(13,600);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,1);
digitalWrite(5,1);
delay(150);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,0);
digitalWrite(5,0);
tone(13, 1200);
delay(150);
tone(13,600);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,1);
digitalWrite(5,1);
delay(150);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,0);
digitalWrite(5,0);
tone(13, 1200);
delay(150);
digitalWrite(2,0);
digitalWrite(3,0);
tone(13,200);
delay(600);
digitalWrite(2,1);
tone(13, 500);
delay(150);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 600);
delay(150);
digitalWrite(4,1);
digitalWrite(3,0);
tone(13,700);
delay(150);
digitalWrite(5,1);
digitalWrite(4,0);
tone(13,800);
delay(150);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13,700);
delay(150);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13,600);
delay(150);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13,500);
delay(250);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 600);
delay(150);
digitalWrite(4,1);
digitalWrite(3,0);
tone(13,700);
delay(150);
digitalWrite(5,1);
digitalWrite(4,0);
tone(13,800);
delay(150);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13,700);
delay(150);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13,600);
delay(150);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13,500);
delay(300);
digitalWrite(3,1);
tone(13,600);
delay(150);
digitalWrite(4,1);
tone(13,700);
delay(150);
digitalWrite(5,1);
tone(13,800);
delay(300);
digitalWrite(2,0);
digitalWrite(4,0);
tone(13,500);
delay(150);
digitalWrite(3,0);
digitalWrite(5,0);
digitalWrite(2,1);
digitalWrite(4,1);
tone(13, 1000);
delay(150);
digitalWrite(4,0);
tone(13, 200);
delay(100);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13,300);
delay(100);
digitalWrite(4,1);
digitalWrite(3,0);
tone(13, 400);
delay(100);
digitalWrite(5,1);
digitalWrite(4,0);
tone(13, 500);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 400);
delay(100);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(1000);
noTone(13);
digitalWrite(2,0);
  ROWonestate = 1; //1 = on
  
  }
  else{//else
   digitalWrite(ROWonepin, LOW); //else, turn off
   digitalWrite(ROWtwopin, LOW);
   digitalWrite(ROWthreepin, LOW);
   digitalWrite(ROWfourpin, LOW);
   ROWonestate = 0;  //change the ROW state to OFF ("LOW")
   
  }
  } 
  ROWonebuttonOld = ROWonebuttonNew;
 delay(dt);
 ROWtwobuttonNew = digitalRead(ROWtwobuttonPin);
 if (ROWtwobuttonOld == 0 && ROWtwobuttonNew == 1){
  if (ROWtwostate == 0){
    Serial.println("Sequence 2 has been activated.");
    Serial.println("Sequence 2 is in action");
digitalWrite(5,1);
tone(13,600);
delay(500);
digitalWrite(2,1);
tone(13,800);
delay(700);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13,200);
delay(700);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(2,1);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 400);
delay(100);
digitalWrite(4,1);
digitalWrite(3,0);
tone(13, 500);
delay(100);
digitalWrite(5,1);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,0);
digitalWrite(2,1);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 400);
delay(100);
digitalWrite(4,1);
digitalWrite(3,0);
tone(13, 500);
delay(100);
digitalWrite(5,1);
digitalWrite(4,0);
tone(13, 600);
delay(500);
digitalWrite(5,1);
tone(13,600);
delay(500);
digitalWrite(2,1);
tone(13,800);
delay(700);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13,200);
delay(500);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(5,1);
tone(13, 600);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13, 500);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 300);
delay(100);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 600);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13, 500);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 300);
delay(300);
digitalWrite(4,1);
tone(13, 400);
delay(300);
digitalWrite(2,1);
tone(13, 600);
delay(100);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 500);
delay(100);
tone(13, 600);
digitalWrite(2,1);
digitalWrite(3,0);
delay(100);
tone(13, 500);
digitalWrite(3,1);
digitalWrite(2,0);
delay(400);
digitalWrite(5,1);
tone(13, 900);
delay(100);
digitalWrite(2,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 900);
delay(100);
digitalWrite(2,1);
digitalWrite(5,0);
tone(13, 600);
delay(1050);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 200);
delay(1000);
noTone(13);
    ROWtwostate = 1;
  }else{
    digitalWrite(ROWonepin, LOW); 
   digitalWrite(ROWtwopin, LOW);
   digitalWrite(ROWthreepin, LOW);
   digitalWrite(ROWfourpin, LOW);
    ROWtwostate = 0;
  }
 }
 ROWtwobuttonOld = ROWtwobuttonNew;
 delay(dt);
 ROWthreebuttonNew = digitalRead(ROWthreebuttonPin);
 if (ROWthreebuttonOld == 0 && ROWthreebuttonNew == 1){
  if (ROWthreestate == 0){
    Serial.println("Sequence 3 has been activated.");
    Serial.println("Sequence 3 is in action.");
digitalWrite(2,1);
tone(13, 200);
delay(400);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13, 400);
delay(400);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13, 600);
delay(1200);
digitalWrite(2,1);
digitalWrite(4,0);
tone(13, 200);
delay(400);
digitalWrite(3,1);
digitalWrite(2,0);
tone(13, 400);
delay(400);
digitalWrite(5,1);
digitalWrite(3,0);
tone(13,1000);
delay(4000);
digitalWrite(5,0);
digitalWrite(2,1);
tone(13, 200);
delay(100);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(5,1);
delay(230);
digitalWrite(5,0);
digitalWrite(2,1);
tone(13, 200);
delay(100);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(5,1);
delay(230);
digitalWrite(5,0);
digitalWrite(2,1);
tone(13, 200);
delay(100);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(5,1);
delay(230);
digitalWrite(5,0);
digitalWrite(2,1);
tone(13, 200);
delay(100);
digitalWrite(2,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(5,1);
delay(300);
digitalWrite(5,0);
noTone(13);
delay(200);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(5,0);
digitalWrite(4,1);
tone(13,600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(3,0);
digitalWrite(2,1);
tone(13, 200);
delay(3700);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(5,1);
tone(13,1200);
delay(600);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13, 800);
delay(300);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(2,1);
digitalWrite(5,1);
tone(13, 400);
delay(300);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13, 800);
delay(300);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(2,1);
digitalWrite(5,1);
tone(13, 400);
delay(300);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13, 800);
delay(2000);
digitalWrite(2,1);
digitalWrite(5,1);
tone(13, 1200);
delay(600);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,1);
tone(13, 600);
delay(100);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
//______
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,1);
tone(13, 600);
delay(100);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,1);
tone(13, 600);
delay(100);
digitalWrite(3,1);
digitalWrite(4,0);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
digitalWrite(5,1);
digitalWrite(4,1);
digitalWrite(3,1);
tone(13,800);
delay(800);
digitalWrite(5,0);
digitalWrite(2,0);
digitalWrite(4,0);
digitalWrite(3,0);
tone(13, 200);
delay(2400);
noTone(13);
    ROWthreestate = 1;
  }
  else{
    digitalWrite(ROWonepin, LOW); //else, turn off
   digitalWrite(ROWtwopin, LOW);
   digitalWrite(ROWthreepin, LOW);
   digitalWrite(ROWfourpin, LOW);
    ROWthreestate = 0;
  }
 }
 ROWthreebuttonOld = ROWthreebuttonNew;
 delay(dt);
 ROWfourbuttonNew = digitalRead(ROWfourbuttonPin);
 if (ROWfourbuttonOld == 0 && ROWfourbuttonNew == 1){
  if (ROWfourstate == 0){
    Serial.println("Sequence 4 has been activated.");
    Serial.println("Sequence 4 is in action.");

digitalWrite(2,1);
digitalWrite(5,1);
tone(13, 200);
delay(400);
digitalWrite(4,1);
digitalWrite(3,1);
tone(13, 800);
delay(400);
digitalWrite(2,0);
digitalWrite(5,0);
tone(13, 500);
delay(400);
digitalWrite(2,1);
digitalWrite(5,1);
tone(13, 1200);
delay(670);
digitalWrite(5,0);
digitalWrite(4,0);
digitalWrite(3,0);
digitalWrite(2,0);
tone(13, 200);
delay(1200);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230); 
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 200);
delay(100);
digitalWrite(4,1);
digitalWrite(3,1);
digitalWrite(2,1);
tone(13,1200);
delay(100);
digitalWrite(5,0);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 2000);
delay(100);
digitalWrite(5,0);
digitalWrite(2,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 700);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 1200);
delay(100);
digitalWrite(4,0);
digitalWrite(2,0);
tone(13, 500);
delay(100);
digitalWrite(5,0);
digitalWrite(3,0);
tone(13, 200);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 200);
delay(100);
digitalWrite(4,1);
digitalWrite(3,1);
digitalWrite(2,1);
tone(13,1200);
delay(100);
digitalWrite(5,0);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 2000);
delay(100);
digitalWrite(5,0);
digitalWrite(2,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 700);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 1200);
delay(100);
digitalWrite(4,0);
digitalWrite(2,0);
tone(13, 500);
delay(100);
digitalWrite(5,0);
digitalWrite(3,0);
tone(13, 200);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 200);
delay(100);
digitalWrite(4,1);
digitalWrite(3,1);
digitalWrite(2,1);
tone(13,1200);
delay(100);
digitalWrite(5,0);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 2000);
delay(100);
digitalWrite(5,0);
digitalWrite(2,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 700);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 1200);
delay(100);
digitalWrite(4,0);
digitalWrite(2,0);
tone(13, 500);
delay(100);
digitalWrite(5,0);
digitalWrite(3,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230); 
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 200);
delay(100);
digitalWrite(4,1);
digitalWrite(3,1);
digitalWrite(2,1);
tone(13,1200);
delay(100);
digitalWrite(5,0);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 2000);
delay(100);
digitalWrite(5,0);
digitalWrite(2,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 700);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 1200);
delay(100);
digitalWrite(4,0);
digitalWrite(2,0);
tone(13, 500);
delay(100);
digitalWrite(5,0);
digitalWrite(3,0);
tone(13, 200);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230);
digitalWrite(2,0);
digitalWrite(5,1);
tone(13,800);
delay(100);
digitalWrite(4,1);
digitalWrite(5,0);
tone(13, 600);
delay(100);
digitalWrite(4,0);
digitalWrite(3,1);
tone(13, 400);
delay(100);
digitalWrite(2,1);
digitalWrite(3,0);
tone(13, 200);
delay(230); 
digitalWrite(2,0);
digitalWrite(5,1);
tone(13, 200);
delay(100);
digitalWrite(4,1);
digitalWrite(3,1);
digitalWrite(2,1);
tone(13,1200);
delay(100);
digitalWrite(5,0);
digitalWrite(4,0);
tone(13, 600);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 300);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 2000);
delay(100);
digitalWrite(5,0);
digitalWrite(2,0);
tone(13, 200);
delay(100);
digitalWrite(5,1);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
tone(13, 700);
delay(100);
digitalWrite(3,1);
digitalWrite(4,1);
tone(13, 1200);
delay(100);
digitalWrite(4,0);
digitalWrite(2,0);
tone(13, 500);
delay(100);
digitalWrite(5,0);
digitalWrite(3,0);
tone(13, 200);
delay(2100);
noTone(13);   
    ROWfourstate = 1;
  }
  else{
    digitalWrite(ROWonepin, LOW); 
   digitalWrite(ROWtwopin, LOW);
   digitalWrite(ROWthreepin, LOW);
   digitalWrite(ROWfourpin, LOW);
    ROWfourstate = 0;
  }
 }
 ROWfourbuttonOld = ROWfourbuttonNew;
}

Credits

nikwon

nikwon

2 projects • 0 followers

Comments

Add projectSign up / Login