-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNano_POV.ino
191 lines (167 loc) · 7.9 KB
/
Nano_POV.ino
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/******************************************************************************\
| ,, |
| db `7MM |
| ;MM: MM |
| ,V^MM. ,pP"Ybd MMpMMMb. .gP"Ya `7Mb,od8 |
| ,M `MM 8I `" MM MM ,M' Yb MM' "' |
| AbmmmqMA `YMMMa. MM MM 8M"""""" MM |
| A' VML L. I8 MM MM YM. , MM |
| .AMA. .AMMA.M9mmmP'.JMML JMML.`Mbmmd'.JMML. |
| |
| |
| ,, ,, |
| .g8"""bgd `7MM db `7MM |
| .dP' `M MM MM |
| dM' ` MM `7MM ,p6"bo MM ,MP' |
| MM MM MM 6M' OO MM ;Y |
| MM. `7MMF' MM MM 8M MM;Mm |
| `Mb. MM MM MM YM. , MM `Mb. |
| `"bmmmdPY .JMML..JMML.YMbmd'.JMML. YA. |
| |
\******************************************************************************/
/******************************************************************************\
| Copyright (c) 2012, Asher Glick |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions are met: |
| |
| * Redistributions of source code must retain the above copyright notice, |
| this list of conditions and the following disclaimer. |
| * Redistributions in binary form must reproduce the above copyright notice, |
| this list of conditions and the following disclaimer in the documentation |
| and/or other materials provided with the distribution. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| POSSIBILITY OF SUCH DAMAGE. |
\******************************************************************************/
#define blue1 3
#define green1 4
#define red1 5
//#define center_common 6
#define INNER_CENTER_COMMON_PIN 6
//#define outer_center_common 7
#define OUTER_CENTER_COMMON_PIN 7
//#define inner_outer_common 8
#define INNER_EDGE_COMMON_PIN 8
//#define outer_common 9
#define OUTER_EDGE_COMMON_PIN 9
#define red2 10
#define green2 11
#define blue2 12
#include "alphabet.h"
char ** alphabet;
//#define COMMON_VALUE 0x00
#define COMMON_ON 0x00
#define COMMON_OFF 0xFF
//#define UNIQUE_VALUE 0xFF
#define COLOR_ON 0xFF
#define COLOR_OFF 0x00
//0xFF is used instead of HIGH (0x01) to provide a speedup when displaying
#define ON 0xff
#define OFF 0x00
#define LED_ON_TIME 250
void setup () {
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
//set all of the ascii values
loadAlphabet(alphabet);
}
void loop() {
displayString("GO ",ON,ON,ON);
displayString("RED ",ON,OFF,OFF);
}
void displayLetter(char letter, char RED, char GREEN, char BLUE) {
for (int i = 0; i < 7; i ++) {
displayByte (alphabet[letter][i] & RED, alphabet[letter][i] & BLUE, alphabet[letter][i] & GREEN);
}
displayByte (0,0,0);
}
void displayByte(char red, char blue, char green) {
digitalWrite(INNER_CENTER_COMMON_PIN, COMMON_OFF);
digitalWrite(OUTER_CENTER_COMMON_PIN, COMMON_OFF);
digitalWrite(INNER_EDGE_COMMON_PIN, COMMON_OFF);
digitalWrite(OUTER_EDGE_COMMON_PIN, COMMON_OFF);
digitalWrite (INNER_CENTER_COMMON_PIN, COMMON_ON);
digitalWrite (blue1 , COLOR_ON & blue & 0x08);
digitalWrite (green1, COLOR_ON & green & 0x08);
digitalWrite (red1, COLOR_ON & red & 0x08);
digitalWrite (blue2, COLOR_ON & blue & 0x10);
digitalWrite (green2, COLOR_ON & green & 0x10);
digitalWrite (red2, COLOR_ON & red & 0x10);
delayMicroseconds (LED_ON_TIME);
digitalWrite (blue1 , COLOR_OFF);
digitalWrite (green1, COLOR_OFF);
digitalWrite (red1, COLOR_OFF);
digitalWrite (blue2, COLOR_OFF);
digitalWrite (green2, COLOR_OFF);
digitalWrite (red2, COLOR_OFF);
digitalWrite (INNER_CENTER_COMMON_PIN, COMMON_OFF);
digitalWrite (OUTER_CENTER_COMMON_PIN, COMMON_ON);
digitalWrite (blue1, COLOR_ON & blue & 0x04);
digitalWrite (green1, COLOR_ON & green & 0x04);
digitalWrite (red1, COLOR_ON & red & 0x04);
digitalWrite (blue2, COLOR_ON & blue & 0x20);
digitalWrite (green2, COLOR_ON & green & 0x20);
digitalWrite (red2, COLOR_ON & red & 0x20);
delayMicroseconds (LED_ON_TIME);
digitalWrite (blue1, COLOR_OFF);
digitalWrite (green1, COLOR_OFF);
digitalWrite (red1, COLOR_OFF);
digitalWrite (blue2, COLOR_OFF);
digitalWrite (green2, COLOR_OFF);
digitalWrite (red2, COLOR_OFF);
digitalWrite (OUTER_CENTER_COMMON_PIN, COMMON_OFF);
digitalWrite (INNER_EDGE_COMMON_PIN, COMMON_ON);
digitalWrite (blue1, COLOR_ON & blue & 0x02);
digitalWrite (green1, COLOR_ON & green & 0x02);
digitalWrite (red1, COLOR_ON & red & 0x02);
digitalWrite (blue2, COLOR_ON & blue & 0x40);
digitalWrite (green2, COLOR_ON & green & 0x40);
digitalWrite (red2, COLOR_ON & red & 0x40);
delayMicroseconds (LED_ON_TIME);
digitalWrite (blue1, COLOR_OFF);
digitalWrite (green1, COLOR_OFF);
digitalWrite (red1, COLOR_OFF);
digitalWrite (blue2, COLOR_OFF);
digitalWrite (green2, COLOR_OFF);
digitalWrite (red2, COLOR_OFF);
digitalWrite (INNER_EDGE_COMMON_PIN, COMMON_OFF);
digitalWrite (OUTER_EDGE_COMMON_PIN, COMMON_ON);
digitalWrite (blue1, COLOR_ON & blue & 0x01);
digitalWrite (green1, COLOR_ON & green & 0x01);
digitalWrite (red1, COLOR_ON & red & 0x01);
digitalWrite (blue2, COLOR_ON & blue & 0x80);
digitalWrite (green2, COLOR_ON & green & 0x80);
digitalWrite (red2, COLOR_ON & red & 0x80);
delayMicroseconds(LED_ON_TIME);
digitalWrite(blue1, COLOR_OFF);
digitalWrite(green1, COLOR_OFF);
digitalWrite(red1, COLOR_OFF);
digitalWrite(blue2, COLOR_OFF);
digitalWrite(green2, COLOR_OFF);
digitalWrite(red2, COLOR_OFF);
digitalWrite(OUTER_EDGE_COMMON_PIN, COMMON_OFF);
}
void displayString (String displayString, char RED, char GREEN, char BLUE) {
for (int i = 0; i < displayString.length(); i++) {
displayLetter(displayString[i],RED,GREEN,BLUE);
}
}