Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //lets make the one function digit... remmember the scatch!!!
- int a=2;
- int b=3;
- int c=4;
- int d=5;
- int e=6;
- int f=7;
- int g=8;
- int p=9;
- void setup()
- {
- pinMode(9, OUTPUT);
- pinMode(2, OUTPUT);
- pinMode(3, OUTPUT);
- pinMode(4, OUTPUT);
- pinMode(5, OUTPUT);
- pinMode(6, OUTPUT);
- pinMode(7, OUTPUT);
- pinMode(8, OUTPUT);
- allOn();
- delay(500);
- allOff();
- }
- void loop()
- {
- bomb();
- }
- void countUp()
- {
- one();
- delay(1000);
- two();
- delay(1000);
- three();
- delay(1000);
- four();
- delay(1000);
- five();
- delay(1000);
- six();
- delay(1000);
- seven();
- delay(1000);
- eight();
- delay(1000);
- nine();
- delay(1000);
- }
- void countDown()
- {
- allOff();
- delay(1000);
- nine();
- delay(1000);
- eight();
- delay(1000);
- seven();
- delay(1000);
- six();
- delay(1000);
- five();
- delay(1000);
- four();
- delay(1000);
- three();
- delay(1000);
- two();
- delay(1000);
- one();
- delay(1000);
- zero();
- delay(1000);
- }
- void bomb()
- {
- allOff();
- delay(1000);
- nine();
- delay(900);
- eight();
- delay(800);
- seven();
- delay(700);
- six();
- delay(600);
- five();
- delay(500);
- four();
- delay(400);
- three();
- delay(300);
- two();
- delay(200);
- one();
- delay(100);
- zero();
- delay(50);
- explosion();
- delay(100);
- }
- void explosion()
- {
- for(int i = 1; i <= 100; i++)
- {
- allOff();
- digitalWrite(a,HIGH);
- delay(30);
- allOff();
- digitalWrite(b,HIGH);
- delay(30);
- allOff();
- digitalWrite(c,HIGH);
- delay(30);
- allOff();
- digitalWrite(d,HIGH);
- delay(30);
- allOff();
- digitalWrite(e,HIGH);
- delay(30);
- allOff();
- digitalWrite(f,HIGH);
- delay(30);
- allOff();
- }
- }
- void allOn()
- {
- for(int led=2; led<=9; led++)
- {
- digitalWrite(led, HIGH);
- }
- }
- void allOff()
- {
- for(int led=2; led<=9; led++)
- {
- digitalWrite(led, LOW);
- }
- }
- void one()
- {
- allOff();
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- }
- void two()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(e,HIGH);
- digitalWrite(d,HIGH);
- }
- void three()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- }
- void four()
- {
- allOff();
- digitalWrite(f,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- }
- void five()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(f,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- }
- void six()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(f,HIGH);
- digitalWrite(e,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- }
- void seven()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- }
- void eight()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- digitalWrite(e,HIGH);
- digitalWrite(f,HIGH);
- digitalWrite(g,HIGH);
- }
- void nine()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- digitalWrite(g,HIGH);
- digitalWrite(f,HIGH);
- }
- void zero()
- {
- allOff();
- digitalWrite(a,HIGH);
- digitalWrite(b,HIGH);
- digitalWrite(c,HIGH);
- digitalWrite(d,HIGH);
- digitalWrite(e,HIGH);
- digitalWrite(f,HIGH);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement