SHARE
TWEET

Arduino LED Bargraph Counter

Braulio777 Jun 12th, 2017 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Arduino Nano LED Bargraph Counter
  2. /*This counter counts from 0 to 10 by completing all LED Bargraph segments and so on */  
  3. void setup() {              
  4.   pinMode(11, OUTPUT);  
  5.   pinMode(10, OUTPUT);
  6.   pinMode(9, OUTPUT);
  7.   pinMode(8, OUTPUT);
  8.   pinMode(7, OUTPUT);
  9.   pinMode(6, OUTPUT);
  10.   pinMode(5, OUTPUT);
  11.   pinMode(4, OUTPUT);
  12.   pinMode(3, OUTPUT);
  13.   pinMode(2, OUTPUT);
  14.   pinMode(12, OUTPUT);  
  15. }
  16. void loop() {
  17.   // write '1'
  18. digitalWrite(11, 1);  
  19. digitalWrite(10, 0);
  20. digitalWrite(9, 0);
  21. digitalWrite(8, 0);
  22. digitalWrite(7, 0);
  23. digitalWrite(6, 0);
  24. digitalWrite(5, 0);
  25. digitalWrite(4, 0);
  26. digitalWrite(3, 0);
  27. digitalWrite(2, 0);
  28. digitalWrite(12, 0);  
  29. delay(1000);
  30.   // write '2'
  31. digitalWrite(11, 1);  
  32. digitalWrite(10, 1);
  33. digitalWrite(9, 0);
  34. digitalWrite(8, 0);
  35. digitalWrite(7, 0);
  36. digitalWrite(6, 0);
  37. digitalWrite(5, 0);
  38. digitalWrite(4, 0);
  39. digitalWrite(3, 0);
  40. digitalWrite(2, 0);
  41. digitalWrite(12, 0);
  42.  delay(1000);
  43.   // write '3'
  44.  digitalWrite(11, 1);  
  45. digitalWrite(10, 1);
  46. digitalWrite(9, 1);
  47. digitalWrite(8, 0);
  48. digitalWrite(7, 0);
  49. digitalWrite(6, 0);
  50. digitalWrite(5, 0);
  51. digitalWrite(4, 0);
  52. digitalWrite(3, 0);
  53. digitalWrite(2, 0);
  54. digitalWrite(12, 0);
  55.  delay(1000);
  56.   // write '4'
  57.  digitalWrite(11, 1);  
  58. digitalWrite(10, 1);
  59. digitalWrite(9, 1);
  60. digitalWrite(8, 1);
  61. digitalWrite(7, 0);
  62. digitalWrite(6, 0);
  63. digitalWrite(5, 0);
  64. digitalWrite(4, 0);
  65. digitalWrite(3, 0);
  66. digitalWrite(2, 0);
  67. digitalWrite(12, 0);
  68.  delay(1000);
  69.  // write '5'
  70.  digitalWrite(11, 1);  
  71. digitalWrite(10, 1);
  72. digitalWrite(9, 1);
  73. digitalWrite(8, 1);
  74. digitalWrite(7, 1);
  75. digitalWrite(6, 0);
  76. digitalWrite(5, 0);
  77. digitalWrite(4, 0);
  78. digitalWrite(3, 0);
  79. digitalWrite(2, 0);
  80. digitalWrite(12, 0);
  81. delay(1000);
  82.  // write '6'
  83. digitalWrite(11, 1);  
  84. digitalWrite(10, 1);
  85. digitalWrite(9, 1);
  86. digitalWrite(8, 1);
  87. digitalWrite(7, 1);
  88. digitalWrite(6, 1);
  89. digitalWrite(5, 0);
  90. digitalWrite(4, 0);
  91. digitalWrite(3, 0);
  92. digitalWrite(2, 0);
  93. digitalWrite(12, 0);
  94.  delay(1000);
  95.  // write '7'
  96. digitalWrite(11, 1);  
  97. digitalWrite(10, 1);
  98. digitalWrite(9, 1);
  99. digitalWrite(8, 1);
  100. digitalWrite(7, 1);
  101. digitalWrite(6, 1);
  102. digitalWrite(5, 1);
  103. digitalWrite(4, 0);
  104. digitalWrite(3, 0);
  105. digitalWrite(2, 0);
  106. digitalWrite(12, 0);
  107.  delay(1000);
  108.  // write '8'
  109. digitalWrite(11, 1);  
  110. digitalWrite(10, 1);
  111. digitalWrite(9, 1);
  112. digitalWrite(8, 1);
  113. digitalWrite(7, 1);
  114. digitalWrite(6, 1);
  115. digitalWrite(5, 1);
  116. digitalWrite(4, 1);
  117. digitalWrite(3, 0);
  118. digitalWrite(2, 0);
  119. digitalWrite(12, 0);
  120.  delay(1000);
  121.  // write '9'
  122.  digitalWrite(11, 1);  
  123. digitalWrite(10, 1);
  124. digitalWrite(9, 1);
  125. digitalWrite(8, 1);
  126. digitalWrite(7, 1);
  127. digitalWrite(6, 1);
  128. digitalWrite(5, 1);
  129. digitalWrite(4, 1);
  130. digitalWrite(3, 1);
  131. digitalWrite(2, 0);
  132. digitalWrite(12, 0);
  133.  delay(1000);
  134.   // write '10'
  135.  digitalWrite(11, 1);  
  136. digitalWrite(10, 1);
  137. digitalWrite(9, 1);
  138. digitalWrite(8, 1);
  139. digitalWrite(7, 1);
  140. digitalWrite(6, 1);
  141. digitalWrite(5, 1);
  142. digitalWrite(4, 1);
  143. digitalWrite(3, 1);
  144. digitalWrite(2, 1);
  145. digitalWrite(12, 0);
  146.  delay(1000);
  147. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top