My favorites | Sign in
Project Home Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* POV Hat
I've measure the radio at 13 cm so about 81cm is the circumference
I've clocked it at about 150 rpm (2.5 revs per second)
400 ms for one revolution
3.8 ms per character 3800 usec

*/
// Prints out the message "ME ADD! ME ADD"
// Created with text2pixels.py
// 8 bits per line, 104 lines long
const byte image[] = {
B11111111,
B11111111,
B11100000,
B01111000,
B00001100,
B00111100,
B11110000,
B11111111,
B11111111,
B00000000,
B00000000,
B11111111,
B11111111,
B11011011,
B11011011,
B11011011,
B10010001,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000111,
B00111111,
B11111100,
B11100100,
B11111100,
B00111111,
B00000111,
B00000000,
B11111111,
B11111111,
B11000011,
B11000011,
B11000011,
B11111111,
B01111110,
B00011000,
B00000000,
B11111111,
B11111111,
B11000011,
B11000011,
B11000011,
B11111111,
B01111110,
B00011000,
B00000000,
B00000000,
B11111011,
B11111011,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B11111111,
B11111111,
B11100000,
B01111000,
B00001100,
B00111100,
B11110000,
B11111111,
B11111111,
B00000000,
B00000000,
B11111111,
B11111111,
B11011011,
B11011011,
B11011011,
B10010001,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000111,
B00111111,
B11111100,
B11100100,
B11111100,
B00111111,
B00000111,
B00000000,
B11111111,
B11111111,
B11000011,
B11000011,
B11000011,
B11111111,
B01111110,
B00011000,
B00000000,
B11111111,
B11111111,
B11000011,
B11000011,
B11000011,
B11111111,
B01111110,
B00011000,
};

int index = 0;
int intercolumn_usec = 3800;
int end_delay_usec = 0;

// In case we get the order wrong
int led_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7 };

void allOff() {
for (int i = 0; i < sizeof(led_pins) / sizeof(int); i++) {
pinMode(led_pins[i], OUTPUT);
digitalWrite(led_pins[i], LOW);
}
}

void ledWarmup() {
allOff();
for (int i = 0; i < sizeof(led_pins) / sizeof(int); i++) {
digitalWrite(led_pins[i], HIGH);
delay(500);
digitalWrite(led_pins[i], LOW);
}
allOff();
}
void setup() {
ledWarmup();
index = 0;
}

void loop() {
display(image[index]);
index += 1;
if (index >= sizeof(image)) {
if (end_delay_usec > 0) {
delayMicroseconds(end_delay_usec);
}
index = 0;
} else {
delayMicroseconds(intercolumn_usec);
}
}

void display(byte toshow) {
for (int i = 0; i < 8; i++) {
if (toshow & B00000001) {
digitalWrite(led_pins[7 - i], HIGH);
} else {
digitalWrite(led_pins[7 - i], LOW);
}
toshow = toshow >> 1;
}
}

Change log

21c7db8fa784 by Scott Kirkwood <scottakirkwood> on Oct 29, 2009   Diff
before the party
Go to: 
Project members, sign in to write a code review

Older revisions

345b8f68201f by Scott Kirkwood <scottakirkwood> on Oct 28, 2009   Diff
About to change pov_hat
All revisions of this file

File info

Size: 2904 bytes, 168 lines
Powered by Google Project Hosting