Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #include "LedControl.h"
  2.  
  3.  
  4.  
  5. byte max_units = 5;
  6. LedControl lc=LedControl(8,10,9,max_units);
  7.  
  8.  
  9. unsigned long delaytime=1;
  10.  
  11. void setup() {
  12.  
  13.  
  14. }
  15.  
  16.  
  17. void writeArduinoOnMatrix() {
  18. /* here is the data for the characters */
  19. byte H[5]={B01111111, B00001000, B00001000, B01111111, B00000000};
  20. byte E[5]={B01111111, B01001001, B01001001, B01000001, B00000000};
  21. byte L[5]={B01111111, B01000000, B01000000, B01000000, B00000000};
  22. byte O[5]={B00111110, B01000001, B01000001, B00111110, B00000000};
  23.  
  24.  
  25. /* now display them one by one with a small delay */
  26. lc.setRow(0,0,H[0]);
  27. lc.setRow(0,1,H[1]);
  28. lc.setRow(0,2,H[2]);
  29. lc.setRow(0,3,H[3]);
  30. lc.setRow(0,4,H[4]);
  31. delay(delaytime);
  32. lc.setRow(1,0,E[0]);
  33. lc.setRow(1,1,E[1]);
  34. lc.setRow(1,2,E[2]);
  35. lc.setRow(1,3,E[3]);
  36. lc.setRow(1,4,E[4]);
  37. delay(delaytime);
  38. lc.setRow(2,0,L[0]);
  39. lc.setRow(2,1,L[1]);
  40. lc.setRow(2,2,L[2]);
  41. lc.setRow(2,3,L[3]);
  42. lc.setRow(2,4,L[4]);
  43. delay(delaytime);
  44. lc.setRow(3,0,L[0]);
  45. lc.setRow(3,1,L[1]);
  46. lc.setRow(3,2,L[2]);
  47. lc.setRow(3,3,L[3]);
  48. lc.setRow(3,4,L[4]);
  49. delay(delaytime);
  50. lc.setRow(4,0,O[0]);
  51. lc.setRow(4,1,O[1]);
  52. lc.setRow(4,2,O[2]);
  53. lc.setRow(4,3,O[3]);
  54. lc.setRow(4,4,O[4]);
  55. delay(delaytime);
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. void set_unit(byte number_of_unit){
  68.  
  69. lc.shutdown(number_of_unit-1,false);
  70. /* Set the brightness to a medium values */
  71. lc.setIntensity(number_of_unit-1,1);
  72. /* and clear the display */
  73. lc.clearDisplay(number_of_unit-1);
  74.  
  75. }
  76.  
  77.  
  78. void single(byte number_of_unit) {
  79. for(int row=0;row<8;row++) {
  80. for(int col=0;col<8;col++) {
  81. delay(delaytime);
  82. lc.setLed(number_of_unit-1,row,col,true);
  83. delay(delaytime);
  84.  
  85. }
  86. }
  87. }
  88.  
  89. void loop() {
  90.  
  91. for (byte i=1;i<6;i++)
  92. {
  93. single(i);
  94. }
  95.  
  96. for(byte i=1;i<6;i++)
  97. {
  98. set_unit(i);
  99. }
  100.  
  101. writeArduinoOnMatrix();
  102. delay(2000);
  103. for(byte i=1;i<6;i++)
  104. {
  105. set_unit(i);
  106. }
  107.  
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement