Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "LedControl.h"
- byte max_units = 5;
- LedControl lc=LedControl(8,10,9,max_units);
- unsigned long delaytime=1;
- void setup() {
- }
- void writeArduinoOnMatrix() {
- /* here is the data for the characters */
- byte H[5]={B01111111, B00001000, B00001000, B01111111, B00000000};
- byte E[5]={B01111111, B01001001, B01001001, B01000001, B00000000};
- byte L[5]={B01111111, B01000000, B01000000, B01000000, B00000000};
- byte O[5]={B00111110, B01000001, B01000001, B00111110, B00000000};
- /* now display them one by one with a small delay */
- lc.setRow(0,0,H[0]);
- lc.setRow(0,1,H[1]);
- lc.setRow(0,2,H[2]);
- lc.setRow(0,3,H[3]);
- lc.setRow(0,4,H[4]);
- delay(delaytime);
- lc.setRow(1,0,E[0]);
- lc.setRow(1,1,E[1]);
- lc.setRow(1,2,E[2]);
- lc.setRow(1,3,E[3]);
- lc.setRow(1,4,E[4]);
- delay(delaytime);
- lc.setRow(2,0,L[0]);
- lc.setRow(2,1,L[1]);
- lc.setRow(2,2,L[2]);
- lc.setRow(2,3,L[3]);
- lc.setRow(2,4,L[4]);
- delay(delaytime);
- lc.setRow(3,0,L[0]);
- lc.setRow(3,1,L[1]);
- lc.setRow(3,2,L[2]);
- lc.setRow(3,3,L[3]);
- lc.setRow(3,4,L[4]);
- delay(delaytime);
- lc.setRow(4,0,O[0]);
- lc.setRow(4,1,O[1]);
- lc.setRow(4,2,O[2]);
- lc.setRow(4,3,O[3]);
- lc.setRow(4,4,O[4]);
- delay(delaytime);
- }
- void set_unit(byte number_of_unit){
- lc.shutdown(number_of_unit-1,false);
- /* Set the brightness to a medium values */
- lc.setIntensity(number_of_unit-1,1);
- /* and clear the display */
- lc.clearDisplay(number_of_unit-1);
- }
- void single(byte number_of_unit) {
- for(int row=0;row<8;row++) {
- for(int col=0;col<8;col++) {
- delay(delaytime);
- lc.setLed(number_of_unit-1,row,col,true);
- delay(delaytime);
- }
- }
- }
- void loop() {
- for (byte i=1;i<6;i++)
- {
- single(i);
- }
- for(byte i=1;i<6;i++)
- {
- set_unit(i);
- }
- writeArduinoOnMatrix();
- delay(2000);
- for(byte i=1;i<6;i++)
- {
- set_unit(i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement