safwan092

Blink_UJ_Project

Sep 25th, 2021
1,026
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int a1 = 2;
  2. int a2 = 3;
  3. int a3 = 4;
  4. int a4 = 5;
  5. int a5 = 6;
  6. int a6 = 7;
  7. int a7 = 8;
  8. int a8 = 9;
  9. int a9 = 10;
  10. int a10 = 11;
  11. int a11 = 12;
  12. int a12 = A0;
  13. int t1 = 500;
  14.  
  15. void setup() {
  16.   pinMode(a1, OUTPUT);
  17.   pinMode(a2, OUTPUT);
  18.   pinMode(a3, OUTPUT);
  19.   pinMode(a4, OUTPUT);
  20.   pinMode(a5, OUTPUT);
  21.   pinMode(a6, OUTPUT);
  22.   pinMode(a7, OUTPUT);
  23.   pinMode(a8, OUTPUT);
  24.   pinMode(a9, OUTPUT);
  25.   pinMode(a10, OUTPUT);
  26.   pinMode(a11, OUTPUT);
  27.   pinMode(a12, OUTPUT);
  28.   allLEDOFF();
  29.   delay(5000);
  30. }
  31.  
  32.  
  33. void loop() {
  34.  
  35.   led13ON();
  36.   delay(5000);
  37.   led13OFF();
  38.   delay(5000);
  39.   for (int j = 0; j < 10; j++) {
  40.     allLEDON();
  41.     delay(500);
  42.     allLEDOFF();
  43.     delay(500);
  44.   }
  45. }
  46.  
  47. void led13OFF() {
  48.   digitalWrite(a1, 1);
  49.   delay(t1);
  50.   digitalWrite(a2, 1);
  51.   delay(t1);
  52.   digitalWrite(a3, 1);
  53.   delay(t1);
  54.   digitalWrite(a4, 1);
  55.   delay(t1);
  56.   digitalWrite(a5, 1);
  57.   delay(t1);
  58.   digitalWrite(a6, 1);
  59.   delay(t1);
  60.   digitalWrite(a7, 1);
  61.   delay(t1);
  62.   digitalWrite(a8, 1);
  63.   delay(t1);
  64.   digitalWrite(a9, 1);
  65.   delay(t1);
  66.   digitalWrite(a10, 1);
  67.   delay(t1);
  68.   digitalWrite(a11, 1);
  69.   delay(t1);
  70.   digitalWrite(a12, 1);
  71.   delay(t1);
  72. }
  73.  
  74. void led13ON() {
  75.  
  76.   digitalWrite(a12, 0);
  77.   delay(t1);
  78.   digitalWrite(a11, 0);
  79.   delay(t1);
  80.   digitalWrite(a10, 0);
  81.   delay(t1);
  82.   digitalWrite(a9, 0);
  83.   delay(t1);
  84.   digitalWrite(a8, 0);
  85.   delay(t1);
  86.   digitalWrite(a7, 0);
  87.   delay(t1);
  88.   digitalWrite(a6, 0);
  89.   delay(t1);
  90.   digitalWrite(a5, 0);
  91.   delay(t1);
  92.   digitalWrite(a4, 0);
  93.   delay(t1);
  94.   digitalWrite(a3, 0);
  95.   delay(t1);
  96.   digitalWrite(a2, 0);
  97.   delay(t1);
  98.   digitalWrite(a1, 0);
  99.   delay(t1);
  100. }
  101.  
  102. void allLEDOFF() {
  103.   digitalWrite(a1,  1);
  104.   digitalWrite(a2,  1);
  105.   digitalWrite(a3,  1);
  106.   digitalWrite(a4,  1);
  107.   digitalWrite(a5,  1);
  108.   digitalWrite(a6,  1);
  109.   digitalWrite(a7,  1);
  110.   digitalWrite(a8,  1);
  111.   digitalWrite(a9,  1);
  112.   digitalWrite(a10, 1);
  113.   digitalWrite(a11, 1);
  114.   digitalWrite(a12, 1);
  115. }
  116.  
  117.  
  118. void allLEDON() {
  119.   digitalWrite(a1,  0);
  120.   digitalWrite(a2,  0);
  121.   digitalWrite(a3,  0);
  122.   digitalWrite(a4,  0);
  123.   digitalWrite(a5,  0);
  124.   digitalWrite(a6,  0);
  125.   digitalWrite(a7,  0);
  126.   digitalWrite(a8,  0);
  127.   digitalWrite(a9,  0);
  128.   digitalWrite(a10, 0);
  129.   digitalWrite(a11, 0);
  130.   digitalWrite(a12, 0);
  131. }
RAW Paste Data