-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRishu_scroll_LED.ino
More file actions
77 lines (68 loc) · 2.03 KB
/
Rishu_scroll_LED.ino
File metadata and controls
77 lines (68 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//We always have to include the library
#include "LedControlMS.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,11,10,1);
/* we always wait a bit between updates of the display */
unsigned long delaytime=100;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,6);
/* and clear the display */
lc.clearDisplay(0);
}
void ScrollOut(int offset, byte* letter)
{
for(int i = offset; i <= 7; i++)
{
int col = i;
lc.setRow(0,col,letter[i-offset]);
}
}
void ScrollIn(int offset, byte* letter)
{
for(int i = 0;i <= offset; i++)
{
int col = offset-i;
lc.setRow(0,col,letter[7-i]);
}
}
void drawLetter(byte* letterOut, byte* letterIn)
{
for(int offset = 0; offset < 8; offset++)
{
ScrollOut(offset, letterOut);
ScrollIn(offset, letterIn);
delay(delaytime);
}
}
void loop() {
/* here is the data for the characters */
byte r[8]={B00000000,B00000000,B00110010,B01001100,B01001000,B01111110,B01000000,B00000000};
byte i[8]={B00000000,B01000010,B01000010,B01111110,B01111110,B01000010,B01000010,B00000000};
byte s[8]={B00000000,B00000000,B01000100,B01001010,B01001010,B01001010,B00110010,B00000000};
byte h[8]={B00000000,B00000000,B01111110,B00001000,B00001000,B00001000,B01111110,B00000000};
byte u[8]={B00000000,B00000000,B01111100,B00000010,B00000010,B00000010,B01111100,B00000000};
byte space[8]={B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};
drawLetter(r, i);
drawLetter(i, s);
drawLetter(s, h);
drawLetter(h, u);
drawLetter(u, space);
drawLetter(space,i);
drawLetter(i,s);
drawLetter(s,space);
drawLetter(space,r);
//writeRishuOnMatrix();
}