Advertisement
Yuvalxp8

Untitled

Feb 13th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.39 KB | None | 0 0
  1. //lets make the one function digit...  remmember the scatch!!!
  2.  
  3. int a=2;
  4. int b=3;
  5. int c=4;
  6. int d=5;
  7. int e=6;
  8. int f=7;
  9. int g=8;
  10.  
  11. int p=9;
  12.  
  13. void setup()
  14. {  
  15.   pinMode(9, OUTPUT);  
  16.  
  17.   pinMode(2, OUTPUT);  
  18.  
  19.   pinMode(3, OUTPUT);  
  20.  
  21.   pinMode(4, OUTPUT);
  22.  
  23.   pinMode(5, OUTPUT);  
  24.  
  25.   pinMode(6, OUTPUT);
  26.  
  27.   pinMode(7, OUTPUT);
  28.  
  29.   pinMode(8, OUTPUT);
  30.  
  31. allOn();
  32. delay(500);
  33. allOff();
  34. }
  35.  
  36. void loop()
  37. {
  38.   bomb();
  39. }
  40.  
  41. void countUp()
  42. {
  43.  one();
  44.  delay(1000);
  45.  two();
  46.  delay(1000);
  47.  three();
  48.  delay(1000);
  49.  four();
  50.  delay(1000);
  51.  five();
  52.  delay(1000);
  53.  six();
  54.  delay(1000);
  55.  seven();
  56.  delay(1000);
  57.  eight();
  58.  delay(1000);
  59.  nine();
  60.  delay(1000);
  61. }
  62.  
  63. void countDown()
  64. {
  65. allOff();
  66. delay(1000);
  67. nine();
  68. delay(1000);  
  69. eight();
  70. delay(1000);  
  71. seven();
  72. delay(1000);  
  73. six();
  74. delay(1000);
  75. five();
  76. delay(1000);  
  77. four();
  78. delay(1000);  
  79. three();
  80. delay(1000);  
  81. two();
  82. delay(1000);  
  83. one();
  84. delay(1000);  
  85. zero();
  86. delay(1000);  
  87. }
  88.  
  89. void bomb()
  90. {
  91. allOff();
  92. delay(1000);
  93. nine();
  94. delay(900);  
  95. eight();
  96. delay(800);  
  97. seven();
  98. delay(700);  
  99. six();
  100. delay(600);
  101. five();
  102. delay(500);  
  103. four();
  104. delay(400);  
  105. three();
  106. delay(300);  
  107. two();
  108. delay(200);  
  109. one();
  110. delay(100);  
  111. zero();
  112. delay(50);  
  113. explosion();
  114. delay(100);
  115. }
  116.  
  117. void explosion()
  118. {
  119.   for(int i = 1; i <= 100; i++)
  120.   {
  121.   allOff();
  122.   digitalWrite(a,HIGH);
  123.   delay(30);
  124.   allOff();
  125.   digitalWrite(b,HIGH);
  126.   delay(30);
  127.   allOff();
  128.   digitalWrite(c,HIGH);
  129.   delay(30);
  130.   allOff();
  131.   digitalWrite(d,HIGH);
  132.   delay(30);
  133.   allOff();
  134.   digitalWrite(e,HIGH);
  135.   delay(30);
  136.   allOff();
  137.   digitalWrite(f,HIGH);
  138.   delay(30);
  139.   allOff();
  140.   }
  141. }
  142.  
  143. void allOn()
  144. {
  145. for(int led=2; led<=9; led++)
  146.   {
  147.     digitalWrite(led, HIGH);  
  148.   }
  149.  
  150. }
  151.  
  152. void allOff()
  153. {
  154.   for(int led=2; led<=9; led++)
  155.   {
  156.     digitalWrite(led, LOW);  
  157.   }
  158.  
  159.  }
  160.  
  161. void one()
  162. {
  163.   allOff();
  164.   digitalWrite(b,HIGH);
  165.   digitalWrite(c,HIGH);
  166. }
  167.  
  168. void two()
  169. {
  170.   allOff();
  171.   digitalWrite(a,HIGH);
  172.   digitalWrite(b,HIGH);
  173.   digitalWrite(g,HIGH);
  174.    digitalWrite(e,HIGH);
  175.   digitalWrite(d,HIGH);
  176. }
  177.  
  178. void three()
  179. {
  180.   allOff();
  181.   digitalWrite(a,HIGH);
  182.   digitalWrite(b,HIGH);
  183.   digitalWrite(g,HIGH);
  184.   digitalWrite(c,HIGH);
  185.   digitalWrite(d,HIGH);
  186. }
  187.  
  188. void four()
  189. {
  190.   allOff();
  191.   digitalWrite(f,HIGH);
  192.   digitalWrite(g,HIGH);
  193.   digitalWrite(b,HIGH);
  194.   digitalWrite(c,HIGH);
  195. }
  196.  
  197. void five()
  198. {
  199.   allOff();
  200.   digitalWrite(a,HIGH);
  201.   digitalWrite(f,HIGH);
  202.   digitalWrite(g,HIGH);
  203.   digitalWrite(c,HIGH);
  204.   digitalWrite(d,HIGH);
  205. }
  206.  
  207. void six()
  208. {
  209.   allOff();
  210.   digitalWrite(a,HIGH);
  211.   digitalWrite(f,HIGH);
  212.   digitalWrite(e,HIGH);
  213.   digitalWrite(g,HIGH);
  214.   digitalWrite(c,HIGH);
  215.   digitalWrite(d,HIGH);
  216. }
  217.  
  218. void seven()
  219. {
  220.   allOff();
  221.   digitalWrite(a,HIGH);
  222.   digitalWrite(b,HIGH);
  223.   digitalWrite(c,HIGH);
  224.  
  225. }
  226.  
  227. void eight()
  228. {
  229.   allOff();
  230.   digitalWrite(a,HIGH);
  231.   digitalWrite(b,HIGH);
  232.   digitalWrite(c,HIGH);
  233.   digitalWrite(d,HIGH);
  234.   digitalWrite(e,HIGH);
  235.   digitalWrite(f,HIGH);
  236.   digitalWrite(g,HIGH);
  237. }
  238.  
  239. void nine()
  240. {
  241.   allOff();
  242.   digitalWrite(a,HIGH);
  243.   digitalWrite(b,HIGH);
  244.   digitalWrite(c,HIGH);
  245.   digitalWrite(d,HIGH);
  246.   digitalWrite(g,HIGH);
  247.   digitalWrite(f,HIGH);
  248. }
  249.  
  250. void zero()
  251. {
  252.     allOff();
  253.   digitalWrite(a,HIGH);
  254.   digitalWrite(b,HIGH);
  255.   digitalWrite(c,HIGH);
  256.   digitalWrite(d,HIGH);
  257.   digitalWrite(e,HIGH);
  258.   digitalWrite(f,HIGH);
  259. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement