Advertisement
Zeda

7segment-arduino

Oct 15th, 2017
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. int led13 = 13;
  2. int led12 = 12;
  3. int led11 = 11;
  4. int led10 = 10;
  5. int led9 = 9;
  6. int led8 = 8;
  7. int led7 = 7;
  8. int pausetime=1000;
  9. void setup() {
  10. pinMode(led13, OUTPUT); //pin13
  11. pinMode(led12, OUTPUT); //pin12
  12. pinMode(led11, OUTPUT); //pin11
  13. pinMode(led10, OUTPUT); //pin10
  14. pinMode(led9, OUTPUT); //pin9
  15. pinMode(led8, OUTPUT); //pin8
  16. pinMode(led7, OUTPUT); //pin7
  17. digitalWrite(led13, LOW);
  18. digitalWrite(led12, LOW);
  19. digitalWrite(led11, LOW);
  20. digitalWrite(led10, LOW);
  21. digitalWrite(led9, LOW);
  22. digitalWrite(led8, LOW);
  23. digitalWrite(led7, LOW);
  24.  
  25. }
  26.  
  27. void loop() {
  28. //0
  29. digitalWrite(led12, HIGH);
  30. digitalWrite(led11, HIGH);
  31. digitalWrite(led10, HIGH);
  32. digitalWrite(led9, HIGH);
  33. digitalWrite(led8, HIGH);
  34. digitalWrite(led7, HIGH);
  35. delay(pausetime);
  36. digitalWrite(led12, LOW);
  37. digitalWrite(led11, LOW);
  38. digitalWrite(led10, LOW);
  39. digitalWrite(led9, LOW);
  40. digitalWrite(led8, LOW);
  41. digitalWrite(led7, LOW);
  42.  
  43. //1
  44. digitalWrite(led12, HIGH);
  45. digitalWrite(led9, HIGH);
  46. delay(pausetime);
  47. digitalWrite(led12, LOW);
  48. digitalWrite(led9, LOW);
  49. //2
  50. digitalWrite(led13, HIGH);
  51. digitalWrite(led11, HIGH);
  52. digitalWrite(led10, HIGH);
  53. digitalWrite(led9, HIGH);
  54. digitalWrite(led8, HIGH);
  55. delay(pausetime);
  56. digitalWrite(led13, LOW);
  57. digitalWrite(led11, LOW);
  58. digitalWrite(led10, LOW);
  59. digitalWrite(led9, LOW);
  60. digitalWrite(led8, LOW);
  61. //3
  62. digitalWrite(led13, HIGH);
  63. digitalWrite(led11, HIGH);
  64. digitalWrite(led10, HIGH);
  65. digitalWrite(led7, HIGH);
  66. digitalWrite(led8, HIGH);
  67. delay(pausetime);
  68. digitalWrite(led13, LOW);
  69. digitalWrite(led11, LOW);
  70. digitalWrite(led10, LOW);
  71. digitalWrite(led7, LOW);
  72. digitalWrite(led8, LOW);
  73. //4
  74. digitalWrite(led13, HIGH);
  75. digitalWrite(led12, HIGH);
  76. digitalWrite(led10, HIGH);
  77. digitalWrite(led7, HIGH);
  78. delay(pausetime);
  79. digitalWrite(led13, LOW);
  80. digitalWrite(led12, LOW);
  81. digitalWrite(led10, LOW);
  82. digitalWrite(led7, LOW);
  83. //5
  84. digitalWrite(led13, HIGH);
  85. digitalWrite(led11, HIGH);
  86. digitalWrite(led12, HIGH);
  87. digitalWrite(led7, HIGH);
  88. digitalWrite(led8, HIGH);
  89. delay(pausetime);
  90. digitalWrite(led13, LOW);
  91. digitalWrite(led11, LOW);
  92. digitalWrite(led12, LOW);
  93. digitalWrite(led7, LOW);
  94. digitalWrite(led8, LOW);
  95. //6
  96. digitalWrite(led13, HIGH);
  97. digitalWrite(led12, HIGH);
  98. digitalWrite(led11, HIGH);
  99. digitalWrite(led7, HIGH);
  100. digitalWrite(led8, HIGH);
  101. digitalWrite(led9, HIGH);
  102. delay(pausetime);
  103. digitalWrite(led13, LOW);
  104. digitalWrite(led12, LOW);
  105. digitalWrite(led11, LOW);
  106. digitalWrite(led7, LOW);
  107. digitalWrite(led8, LOW);
  108. digitalWrite(led9, LOW);
  109. //7
  110. digitalWrite(led12, HIGH);
  111. digitalWrite(led11, HIGH);
  112. digitalWrite(led10, HIGH);
  113. digitalWrite(led7, HIGH);
  114. delay(pausetime);
  115. digitalWrite(led10, LOW);
  116. digitalWrite(led12, LOW);
  117. digitalWrite(led11, LOW);
  118. digitalWrite(led7, LOW);
  119. //8
  120. digitalWrite(led13, HIGH);
  121. digitalWrite(led12, HIGH);
  122. digitalWrite(led11, HIGH);
  123. digitalWrite(led10, HIGH);
  124. digitalWrite(led9, HIGH);
  125. digitalWrite(led8, HIGH);
  126. digitalWrite(led7, HIGH);
  127. delay(pausetime);
  128. digitalWrite(led13, LOW);
  129. digitalWrite(led12, LOW);
  130. digitalWrite(led11, LOW);
  131. digitalWrite(led10, LOW);
  132. digitalWrite(led9, LOW);
  133. digitalWrite(led8, LOW);
  134. digitalWrite(led7, LOW);
  135. //9
  136. digitalWrite(led13, HIGH);
  137. digitalWrite(led12, HIGH);
  138. digitalWrite(led11, HIGH);
  139. digitalWrite(led10, HIGH);
  140. digitalWrite(led8, HIGH);
  141. digitalWrite(led7, HIGH);
  142. delay(pausetime);
  143. digitalWrite(led13, LOW);
  144. digitalWrite(led12, LOW);
  145. digitalWrite(led11, LOW);
  146. digitalWrite(led10, LOW);
  147. digitalWrite(led8, LOW);
  148. digitalWrite(led7, LOW);
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement