Digital Etcha Sketch

From NYC Resistor Wiki
Jump to: navigation, search

Digital Etch-A-Sketch[edit]

No Pics yet.

Description[edit]

This is a work in progress currently.

Hardware[edit]

* LED Array ( Sure Electronics 6432 R/G LED Array board )
* Arduino Deumilinov 
* 5 Arcade Buttons
* Some laser cut Acryllic

Source Code[edit]

  0 #include <avr/pgmspace.h>
  1 
  2 char STRING[ ] = "AWESOME  AUGUST  ";
  3 
  4 int A_pin = 2; // Data pin for rows selection A  PORTD 4
  5 int B_pin = 3; // Data pin for rows selection B  PORTD 5
  6 int C_pin = 4; // Data pin for rows selection C  PORTD 6
  7 int D_pin = 5; // Data pin for rows selection D  PORTD 7
  8 
  9 int G1_pin = 6; //green leds for uppwer rows  PORTD 11
 10 int G2_pin = 7; //green leds for lower rows   PORTD 12
 11 int R1_pin = 11; //red leds for uppwer rows   PORTB 4
 12 int R2_pin = 12; //red leds for lower rows    PORTB 5
 13 
 14 int S_pin = 8; //Clock pin
 15 int L_pin = 9; //Latch pin
 16 int E_pin = 10; //Enable pin
 17 
 18 int xdelay = 0;
 19 char buffer[8][8];
 20 
 21 //Start the letter definition and put it in the FLASH memory
 22 
 23 //Spc 20
 24 char CH200[] PROGMEM = "11111111";
 25 char CH201[] PROGMEM = "11111111";
 26 char CH202[] PROGMEM = "11111111";
 27 char CH203[] PROGMEM = "11111111";
 28 char CH204[] PROGMEM = "11111111";
 29 char CH205[] PROGMEM = "11111111";
 30 char CH206[] PROGMEM = "11111111";
 31 char CH207[] PROGMEM = "11111111";
 32 //! 21
 33 char CH210[] PROGMEM = "11110111";
 34 char CH211[] PROGMEM = "11100011";
 35 char CH212[] PROGMEM = "11100011";
 36 char CH213[] PROGMEM = "11100011";
 37 char CH214[] PROGMEM = "11110111";
 38 char CH215[] PROGMEM = "11111111";
 39 char CH216[] PROGMEM = "11110111";
 40 char CH217[] PROGMEM = "11111111";
 41 //qt 22
 42 char CH220[] PROGMEM = "11001100";
 43 char CH221[] PROGMEM = "11001100";
 44 char CH222[] PROGMEM = "11001100";
 45 char CH223[] PROGMEM = "11001100";
 46 char CH224[] PROGMEM = "11111111";
 47 char CH225[] PROGMEM = "11111111";
 48 char CH226[] PROGMEM = "11111111";
 49 char CH227[] PROGMEM = "11111111";
 50 //# 23
 51 char CH230[] PROGMEM = "11101101";
 52 char CH231[] PROGMEM = "11101101";
 53 char CH232[] PROGMEM = "11000000";
 54 char CH233[] PROGMEM = "11101101";
 55 char CH234[] PROGMEM = "11000000";
 56 char CH235[] PROGMEM = "11101101";
 57 char CH236[] PROGMEM = "11101101";
 58 char CH237[] PROGMEM = "11111111";
 59 //$ 24
 60 char CH240[] PROGMEM = "11110111";
 61 char CH241[] PROGMEM = "11000001";
 62 char CH242[] PROGMEM = "10110111";
 63 char CH243[] PROGMEM = "11000001";
 64 char CH244[] PROGMEM = "11110110";
 65 char CH245[] PROGMEM = "11000001";
 66 char CH246[] PROGMEM = "11110111";
 67 char CH247[] PROGMEM = "11111111";
 68 //% 25
 69 char CH250[] PROGMEM = "11011110";
 70 char CH251[] PROGMEM = "10101101";
 71 char CH252[] PROGMEM = "11011011";
 72 char CH253[] PROGMEM = "11110111";
 73 char CH254[] PROGMEM = "11101101";
 74 char CH255[] PROGMEM = "11011010";
 75 char CH256[] PROGMEM = "10111101";
 76 char CH257[] PROGMEM = "11111111";
 77 //& 26
 78 char CH260[] PROGMEM = "11100111";
 79 char CH261[] PROGMEM = "11011011";
 80 char CH262[] PROGMEM = "11010111";
 81 char CH263[] PROGMEM = "11101111";
 82 char CH264[] PROGMEM = "11010110";
 83 char CH265[] PROGMEM = "11011001";
 84 char CH266[] PROGMEM = "11100010";
 85 char CH267[] PROGMEM = "11111111";
 86 //' 27
 87 char CH270[] PROGMEM = "11111100";
 88 char CH271[] PROGMEM = "11111001";
 89 char CH272[] PROGMEM = "11110011";
 90 char CH273[] PROGMEM = "11100111";
 91 char CH274[] PROGMEM = "11001111";
 92 char CH275[] PROGMEM = "11111111";
 93 char CH276[] PROGMEM = "11111111";
 94 char CH277[] PROGMEM = "11111111";
 95 //( 28
 96 char CH280[] PROGMEM = "11100111";
 97 char CH281[] PROGMEM = "11011111";
 98 char CH282[] PROGMEM = "10111111";
 99 char CH283[] PROGMEM = "10111111";
100 char CH284[] PROGMEM = "10111111";
101 char CH285[] PROGMEM = "11011111";
102 char CH286[] PROGMEM = "11100111";
103 char CH287[] PROGMEM = "11111111";
104 //) 29
105 char CH290[] PROGMEM = "11110011";
106 char CH291[] PROGMEM = "11111101";
107 char CH292[] PROGMEM = "11111110";
108 char CH293[] PROGMEM = "11111110";
109 char CH294[] PROGMEM = "11111110";
110 char CH295[] PROGMEM = "11111101";
111 char CH296[] PROGMEM = "11110011";
112 char CH297[] PROGMEM = "11111111";
113 //* 2A
114 char CH2A0[] PROGMEM = "10111110";
115 char CH2A1[] PROGMEM = "11011101";
116 char CH2A2[] PROGMEM = "11101011";
117 char CH2A3[] PROGMEM = "10000000";
118 char CH2A4[] PROGMEM = "11101011";
119 char CH2A5[] PROGMEM = "11011101";
120 char CH2A6[] PROGMEM = "10111110";
121 char CH2A7[] PROGMEM = "11111111";
122 //+ 2B
123 char CH2B0[] PROGMEM = "11110111";
124 char CH2B1[] PROGMEM = "11110111";
125 char CH2B2[] PROGMEM = "11110111";
126 char CH2B3[] PROGMEM = "10000000";
127 char CH2B4[] PROGMEM = "11110111";
128 char CH2B5[] PROGMEM = "11110111";
129 char CH2B6[] PROGMEM = "11110111";
130 char CH2B7[] PROGMEM = "11111111";
131 //, 2C
132 char CH2C0[] PROGMEM = "11111111";
133 char CH2C1[] PROGMEM = "11111111";
134 char CH2C2[] PROGMEM = "11111111";
135 char CH2C3[] PROGMEM = "11100111";
136 char CH2C4[] PROGMEM = "11000111";
137 char CH2C5[] PROGMEM = "11000111";
138 char CH2C6[] PROGMEM = "11011111";
139 char CH2C7[] PROGMEM = "11111111";
140 // 2D
141 char CH2D0[] PROGMEM = "11111111";
142 char CH2D1[] PROGMEM = "11111111";
143 char CH2D2[] PROGMEM = "11111111";
144 char CH2D3[] PROGMEM = "11000000";
145 char CH2D4[] PROGMEM = "11000000";
146 char CH2D5[] PROGMEM = "11111111";
147 char CH2D6[] PROGMEM = "11111111";
148 char CH2D7[] PROGMEM = "11111111";
149 //. 2E
150 char CH2E0[] PROGMEM = "11111111";
151 char CH2E1[] PROGMEM = "11111111";
152 char CH2E2[] PROGMEM = "11111111";
153 char CH2E3[] PROGMEM = "11100011";
154 char CH2E4[] PROGMEM = "11000001";
155 char CH2E5[] PROGMEM = "11000001";
156 char CH2E6[] PROGMEM = "11100011";
157 char CH2E7[] PROGMEM = "11111111";
158 /// 2F
159 char CH2F0[] PROGMEM = "11111110";
160 char CH2F1[] PROGMEM = "11111100";
161 char CH2F2[] PROGMEM = "11111001";
162 char CH2F3[] PROGMEM = "11110011";
163 char CH2F4[] PROGMEM = "11100111";
164 char CH2F5[] PROGMEM = "11001111";
165 char CH2F6[] PROGMEM = "11011111";
166 char CH2F7[] PROGMEM = "11111111";
167 //0 30
168 char CH300[] PROGMEM = "11100011";
169 char CH301[] PROGMEM = "11011101";
170 char CH302[] PROGMEM = "10111010";
171 char CH303[] PROGMEM = "10110110";
172 char CH304[] PROGMEM = "10101110";
173 char CH305[] PROGMEM = "11011101";
174 char CH306[] PROGMEM = "11100011";
175 char CH307[] PROGMEM = "11111111";
176 //1 31
177 char CH310[] PROGMEM = "11110111";
178 char CH311[] PROGMEM = "11100111";
179 char CH312[] PROGMEM = "11010111";
180 char CH313[] PROGMEM = "11110111";
181 char CH314[] PROGMEM = "11110111";
182 char CH315[] PROGMEM = "11110111";
183 char CH316[] PROGMEM = "11000001";
184 char CH317[] PROGMEM = "11111111";
185 //2 32
186 char CH320[] PROGMEM = "11100011";
187 char CH321[] PROGMEM = "11011101";
188 char CH322[] PROGMEM = "11111101";
189 char CH323[] PROGMEM = "11111011";
190 char CH324[] PROGMEM = "11110111";
191 char CH325[] PROGMEM = "11101111";
192 char CH326[] PROGMEM = "11000000";
193 char CH327[] PROGMEM = "11111111";
194 //3 33
195 char CH330[] PROGMEM = "11000001";
196 char CH331[] PROGMEM = "10111110";
197 char CH332[] PROGMEM = "11111110";
198 char CH333[] PROGMEM = "11110001";
199 char CH334[] PROGMEM = "11111110";
200 char CH335[] PROGMEM = "10111110";
201 char CH336[] PROGMEM = "11000001";
202 char CH337[] PROGMEM = "11111111";
203 //4 34
204 char CH340[] PROGMEM = "11110011";
205 char CH341[] PROGMEM = "11101011";
206 char CH342[] PROGMEM = "11011011";
207 char CH343[] PROGMEM = "10000000";
208 char CH344[] PROGMEM = "11111011";
209 char CH345[] PROGMEM = "11111011";
210 char CH346[] PROGMEM = "11100001";
211 char CH347[] PROGMEM = "11111111";
212 //5 35
213 char CH350[] PROGMEM = "10000000";
214 char CH351[] PROGMEM = "10111111";
215 char CH352[] PROGMEM = "10100001";
216 char CH353[] PROGMEM = "10011110";
217 char CH354[] PROGMEM = "11111110";
218 char CH355[] PROGMEM = "10111110";
219 char CH356[] PROGMEM = "11000001";
220 char CH357[] PROGMEM = "11111111";
221 //6 36
222 char CH360[] PROGMEM = "11100001";
223 char CH361[] PROGMEM = "11011110";
224 char CH362[] PROGMEM = "10111111";
225 char CH363[] PROGMEM = "10100001";
226 char CH364[] PROGMEM = "10011110";
227 char CH365[] PROGMEM = "10111110";
228 char CH366[] PROGMEM = "11000001";
229 char CH367[] PROGMEM = "11111111";
230 //7 37
231 char CH370[] PROGMEM = "10000000";
232 char CH371[] PROGMEM = "10111110";
233 char CH372[] PROGMEM = "11111101";
234 char CH373[] PROGMEM = "11111011";
235 char CH374[] PROGMEM = "11110111";
236 char CH375[] PROGMEM = "11110111";
237 char CH376[] PROGMEM = "11110111";
238 char CH377[] PROGMEM = "11111111";
239 //8 38
240 char CH380[] PROGMEM = "11000001";
241 char CH381[] PROGMEM = "10111110";
242 char CH382[] PROGMEM = "10111110";
243 char CH383[] PROGMEM = "11000001";
244 char CH384[] PROGMEM = "10111110";
245 char CH385[] PROGMEM = "10111110";
246 char CH386[] PROGMEM = "11000001";
247 char CH387[] PROGMEM = "11111111";
248 //9 39
249 char CH390[] PROGMEM = "11000001";
250 char CH391[] PROGMEM = "10111110";
251 char CH392[] PROGMEM = "10111110";
252 char CH393[] PROGMEM = "11000000";
253 char CH394[] PROGMEM = "11111110";
254 char CH395[] PROGMEM = "10111101";
255 char CH396[] PROGMEM = "11000011";
256 char CH397[] PROGMEM = "11111111";
257 //: 3A
258 char CH3A0[] PROGMEM = "11100011";
259 char CH3A1[] PROGMEM = "11000001";
260 char CH3A2[] PROGMEM = "11100011";
261 char CH3A3[] PROGMEM = "11111111";
262 char CH3A4[] PROGMEM = "11100011";
263 char CH3A5[] PROGMEM = "11000001";
264 char CH3A6[] PROGMEM = "11100011";
265 char CH3A7[] PROGMEM = "11111111";
266 //; 3B
267 char CH3B0[] PROGMEM = "11100011";
268 char CH3B1[] PROGMEM = "11100011";
269 char CH3B2[] PROGMEM = "11100011";
270 char CH3B3[] PROGMEM = "11111111";
271 char CH3B4[] PROGMEM = "11100011";
272 char CH3B5[] PROGMEM = "11100011";
273 char CH3B6[] PROGMEM = "11101111";
274 char CH3B7[] PROGMEM = "11111111";
275 //< 3C
276 char CH3C0[] PROGMEM = "11110011";
277 char CH3C1[] PROGMEM = "11100111";
278 char CH3C2[] PROGMEM = "11001111";
279 char CH3C3[] PROGMEM = "10011111";
280 char CH3C4[] PROGMEM = "11001111";
281 char CH3C5[] PROGMEM = "11100111";
282 char CH3C6[] PROGMEM = "11110011";
283 char CH3C7[] PROGMEM = "11111111";
284 //= 3D
285 char CH3D0[] PROGMEM = "11111111";
286 char CH3D1[] PROGMEM = "10000000";
287 char CH3D2[] PROGMEM = "10000000";
288 char CH3D3[] PROGMEM = "11111111";
289 char CH3D4[] PROGMEM = "10000000";
290 char CH3D5[] PROGMEM = "10000000";
291 char CH3D6[] PROGMEM = "11111111";
292 char CH3D7[] PROGMEM = "11111111";
293 //> 3E
294 char CH3E0[] PROGMEM = "11100111";
295 char CH3E1[] PROGMEM = "11110011";
296 char CH3E2[] PROGMEM = "11111001";
297 char CH3E3[] PROGMEM = "11111100";
298 char CH3E4[] PROGMEM = "11111001";
299 char CH3E5[] PROGMEM = "11110011";
300 char CH3E6[] PROGMEM = "11100111";
301 char CH3E7[] PROGMEM = "11111111";
302 //? 3F
303 char CH3F0[] PROGMEM = "11000001";
304 char CH3F1[] PROGMEM = "10111110";
305 char CH3F2[] PROGMEM = "11111001";
306 char CH3F3[] PROGMEM = "11110111";
307 char CH3F4[] PROGMEM = "11110111";
308 char CH3F5[] PROGMEM = "11111111";
309 char CH3F6[] PROGMEM = "11110111";
310 char CH3F7[] PROGMEM = "11111111";
311 //@ 40
312 char CH400[] PROGMEM = "11100001";
313 char CH401[] PROGMEM = "11011110";
314 char CH402[] PROGMEM = "10110010";
315 char CH403[] PROGMEM = "10101010";
316 char CH404[] PROGMEM = "10100001";
317 char CH405[] PROGMEM = "10111111";
318 char CH406[] PROGMEM = "11000001";
319 char CH407[] PROGMEM = "11111111";
320 //A 07
321 char CH070[] PROGMEM = "11110011";
322 char CH071[] PROGMEM = "11101101";
323 char CH072[] PROGMEM = "11011110";
324 char CH073[] PROGMEM = "11000000";
325 char CH074[] PROGMEM = "11011110";
326 char CH075[] PROGMEM = "11011110";
327 char CH076[] PROGMEM = "11011110";
328 char CH077[] PROGMEM = "11111111";
329 //B 815
330 char CH8150[] PROGMEM = "11000001";
331 char CH8151[] PROGMEM = "11011110";
332 char CH8152[] PROGMEM = "11011110";
333 char CH8153[] PROGMEM = "11000001";
334 char CH8154[] PROGMEM = "11011110";
335 char CH8155[] PROGMEM = "11011110";
336 char CH8156[] PROGMEM = "11000001";
337 char CH8157[] PROGMEM = "11111111";
338 //C 1623
339 char CH16230[] PROGMEM = "11100001";
340 char CH16231[] PROGMEM = "11011110";
341 char CH16232[] PROGMEM = "11011111";
342 char CH16233[] PROGMEM = "11011111";
343 char CH16234[] PROGMEM = "11011111";
344 char CH16235[] PROGMEM = "11011110";
345 char CH16236[] PROGMEM = "11100001";
346 char CH16237[] PROGMEM = "11111111";
347 //D 2431
348 char CH24310[] PROGMEM = "11000001";
349 char CH24311[] PROGMEM = "11011110";
350 char CH24312[] PROGMEM = "11011110";
351 char CH24313[] PROGMEM = "11011110";
352 char CH24314[] PROGMEM = "11011110";
353 char CH24315[] PROGMEM = "11011110";
354 char CH24316[] PROGMEM = "11000001";
355 char CH24317[] PROGMEM = "11111111";
356 //E 3138
357 char CH31380[] PROGMEM = "11000000";
358 char CH31381[] PROGMEM = "11011111";
359 char CH31382[] PROGMEM = "11011111";
360 char CH31383[] PROGMEM = "11000011";
361 char CH31384[] PROGMEM = "11011111";
362 char CH31385[] PROGMEM = "11011111";
363 char CH31386[] PROGMEM = "11000000";
364 char CH31387[] PROGMEM = "11111111";
365 //F 3946
366 char CH39460[] PROGMEM = "11000000";
367 char CH39461[] PROGMEM = "11011111";
368 char CH39462[] PROGMEM = "11011111";
369 char CH39463[] PROGMEM = "11000011";
370 char CH39464[] PROGMEM = "11011111";
371 char CH39465[] PROGMEM = "11011111";
372 char CH39466[] PROGMEM = "11011111";
373 char CH39467[] PROGMEM = "11111111";
374 //G 4754
375 char CH47540[] PROGMEM = "11100001";
376 char CH47541[] PROGMEM = "11011110";
377 char CH47542[] PROGMEM = "11011111";
378 char CH47543[] PROGMEM = "11011000";
379 char CH47544[] PROGMEM = "11011110";
380 char CH47545[] PROGMEM = "11011110";
381 char CH47546[] PROGMEM = "11100000";
382 char CH47547[] PROGMEM = "11111111";
383 //H 5562
384 char CH55620[] PROGMEM = "11011110";
385 char CH55621[] PROGMEM = "11011110";
386 char CH55622[] PROGMEM = "11011110";
387 char CH55623[] PROGMEM = "11000000";
388 char CH55624[] PROGMEM = "11011110";
389 char CH55625[] PROGMEM = "11011110";
390 char CH55626[] PROGMEM = "11011110";
391 char CH55627[] PROGMEM = "11111111";
392 //I 5663
393 char CH0[] PROGMEM = "11000000";
394 char CH1[] PROGMEM = "11110011";
395 char CH2[] PROGMEM = "11110011";
396 char CH3[] PROGMEM = "11110011";
397 char CH4[] PROGMEM = "11110011";
398 char CH5[] PROGMEM = "11110011";
399 char CH6[] PROGMEM = "11000000";
400 char CH7[] PROGMEM = "11111111";
401 //J 6471
402 char CH64710[] PROGMEM = "11000000";
403 char CH64711[] PROGMEM = "11111110";
404 char CH64712[] PROGMEM = "11111110";
405 char CH64713[] PROGMEM = "11111110";
406 char CH64714[] PROGMEM = "11011110";
407 char CH64715[] PROGMEM = "11011110";
408 char CH64716[] PROGMEM = "11100001";
409 char CH64717[] PROGMEM = "11111111";
410 //K 7279
411 char CH72790[] PROGMEM = "11011110";
412 char CH72791[] PROGMEM = "11011101";
413 char CH72792[] PROGMEM = "11011011";
414 char CH72793[] PROGMEM = "11000111";
415 char CH72794[] PROGMEM = "11011011";
416 char CH72795[] PROGMEM = "11011101";
417 char CH72796[] PROGMEM = "11011110";
418 char CH72797[] PROGMEM = "11111111";
419 //L 8087
420 char CH80870[] PROGMEM = "11011111";
421 char CH80871[] PROGMEM = "11011111";
422 char CH80872[] PROGMEM = "11011111";
423 char CH80873[] PROGMEM = "11011111";
424 char CH80874[] PROGMEM = "11011111";
425 char CH80875[] PROGMEM = "11011111";
426 char CH80876[] PROGMEM = "11000000";
427 char CH80877[] PROGMEM = "11111111";
428 //M 8895
429 char CH88950[] PROGMEM = "11011110";
430 char CH88951[] PROGMEM = "11001100";
431 char CH88952[] PROGMEM = "11010010";
432 char CH88953[] PROGMEM = "11011110";
433 char CH88954[] PROGMEM = "11011110";
434 char CH88955[] PROGMEM = "11011110";
435 char CH88956[] PROGMEM = "11011110";
436 char CH88957[] PROGMEM = "11111111";
437 //N 96103
438 char CH961030[] PROGMEM = "11011110";
439 char CH961031[] PROGMEM = "11001110";
440 char CH961032[] PROGMEM = "11000110";
441 char CH961033[] PROGMEM = "11010010";
442 char CH961034[] PROGMEM = "11011000";
443 char CH961035[] PROGMEM = "11011100";
444 char CH961036[] PROGMEM = "11011110";
445 char CH961037[] PROGMEM = "11111111";
446 //O 104111
447 char CH1041110[] PROGMEM = "11000001";
448 char CH1041111[] PROGMEM = "10111110";
449 char CH1041112[] PROGMEM = "10111110";
450 char CH1041113[] PROGMEM = "10111110";
451 char CH1041114[] PROGMEM = "10111110";
452 char CH1041115[] PROGMEM = "10111110";
453 char CH1041116[] PROGMEM = "11000001";
454 char CH1041117[] PROGMEM = "11111111";
455 //P 112119
456 char CH1121190[] PROGMEM = "11000001";
457 char CH1121191[] PROGMEM = "11011110";
458 char CH1121192[] PROGMEM = "11011110";
459 char CH1121193[] PROGMEM = "11000001";
460 char CH1121194[] PROGMEM = "11011111";
461 char CH1121195[] PROGMEM = "11011111";
462 char CH1121196[] PROGMEM = "11011111";
463 char CH1121197[] PROGMEM = "11111111";
464 //Q 120127
465 char CH1201270[] PROGMEM = "11100001";
466 char CH1201271[] PROGMEM = "11011110";
467 char CH1201272[] PROGMEM = "11011110";
468 char CH1201273[] PROGMEM = "11011110";
469 char CH1201274[] PROGMEM = "11011010";
470 char CH1201275[] PROGMEM = "11011100";
471 char CH1201276[] PROGMEM = "11100000";
472 char CH1201277[] PROGMEM = "11111111";
473 //R 128135
474 char CH1281350[] PROGMEM = "11000001";
475 char CH1281351[] PROGMEM = "11011110";
476 char CH1281352[] PROGMEM = "11011110";
477 char CH1281353[] PROGMEM = "11000001";
478 char CH1281354[] PROGMEM = "11011011";
479 char CH1281355[] PROGMEM = "11011101";
480 char CH1281356[] PROGMEM = "11011110";
481 char CH1281357[] PROGMEM = "11111111";
482 //S 136143
483 char CH1361430[] PROGMEM = "11100001";
484 char CH1361431[] PROGMEM = "11011110";
485 char CH1361432[] PROGMEM = "11011111";
486 char CH1361433[] PROGMEM = "11100001";
487 char CH1361434[] PROGMEM = "11111110";
488 char CH1361435[] PROGMEM = "11011110";
489 char CH1361436[] PROGMEM = "11100001";
490 char CH1361437[] PROGMEM = "11111111";
491 //T 144151
492 char CH1441510[] PROGMEM = "11000000";
493 char CH1441511[] PROGMEM = "11110011";
494 char CH1441512[] PROGMEM = "11110011";
495 char CH1441513[] PROGMEM = "11110011";
496 char CH1441514[] PROGMEM = "11110011";
497 char CH1441515[] PROGMEM = "11110011";
498 char CH1441516[] PROGMEM = "11110011";
499 char CH1441517[] PROGMEM = "11111111";
500 //U 152159
501 char CH1521590[] PROGMEM = "11011110";
502 char CH1521591[] PROGMEM = "11011110";
503 char CH1521592[] PROGMEM = "11011110";
504 char CH1521593[] PROGMEM = "11011110";
505 char CH1521594[] PROGMEM = "11011110";
506 char CH1521595[] PROGMEM = "11011110";
507 char CH1521596[] PROGMEM = "11100001";
508 char CH1521597[] PROGMEM = "11111111";
509 //V 160167
510 char CH1601670[] PROGMEM = "10111110";
511 char CH1601671[] PROGMEM = "10111110";
512 char CH1601672[] PROGMEM = "11011101";
513 char CH1601673[] PROGMEM = "11011101";
514 char CH1601674[] PROGMEM = "11101011";
515 char CH1601675[] PROGMEM = "11101011";
516 char CH1601676[] PROGMEM = "11110111";
517 char CH1601677[] PROGMEM = "11111111";
518 //W 168175
519 char CH1681750[] PROGMEM = "10111110";
520 char CH1681751[] PROGMEM = "10111110";
521 char CH1681752[] PROGMEM = "10111110";
522 char CH1681753[] PROGMEM = "10110110";
523 char CH1681754[] PROGMEM = "10101010";
524 char CH1681755[] PROGMEM = "10011100";
525 char CH1681756[] PROGMEM = "10111110";
526 char CH1681757[] PROGMEM = "11111111";
527 //X 176183
528 char CH1761830[] PROGMEM = "10111110";
529 char CH1761831[] PROGMEM = "11011101";
530 char CH1761832[] PROGMEM = "11101011";
531 char CH1761833[] PROGMEM = "11110111";
532 char CH1761834[] PROGMEM = "11101011";
533 char CH1761835[] PROGMEM = "11011101";
534 char CH1761836[] PROGMEM = "10111110";
535 char CH1761837[] PROGMEM = "11111111";
536 //Y 184191
537 char CH1841910[] PROGMEM = "10111110";
538 char CH1841911[] PROGMEM = "11011101";
539 char CH1841912[] PROGMEM = "11101011";
540 char CH1841913[] PROGMEM = "11110111";
541 char CH1841914[] PROGMEM = "11110111";
542 char CH1841915[] PROGMEM = "11110111";
543 char CH1841916[] PROGMEM = "11110111";
544 char CH1841917[] PROGMEM = "11111111";
545 //Z 192199
546 char CH1921990[] PROGMEM = "10000000";
547 char CH1921991[] PROGMEM = "11111101";
548 char CH1921992[] PROGMEM = "11111011";
549 char CH1921993[] PROGMEM = "11110111";
550 char CH1921994[] PROGMEM = "11101111";
551 char CH1921995[] PROGMEM = "11011111";
552 char CH1921996[] PROGMEM = "10000000";
553 char CH1921997[] PROGMEM = "11111111";
554 
555 
556 char chl[ ] = {' ','!','q','#','$','%','&','\'','(',')','*','+',',','-', '.','/',
557               '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@',
558               'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
559 
560 PGM_P CHL[] PROGMEM= {
561 CH200,CH201,CH202,CH203,CH204,CH205,CH206,CH207,
562 CH210,CH211,CH212,CH213,CH214,CH215,CH216,CH217,
563 CH220,CH221,CH222,CH223,CH224,CH225,CH226,CH227,
564 CH230,CH231,CH232,CH233,CH234,CH235,CH236,CH237,
565 CH240,CH241,CH242,CH243,CH244,CH245,CH246,CH247,
566 CH250,CH251,CH252,CH253,CH254,CH255,CH256,CH257,
567 CH260,CH261,CH262,CH263,CH264,CH265,CH266,CH267,
568 CH270,CH271,CH272,CH273,CH274,CH275,CH276,CH277,
569 CH280,CH281,CH282,CH283,CH284,CH285,CH286,CH287,
570 CH290,CH291,CH292,CH293,CH294,CH295,CH296,CH297,
571 CH2A0,CH2A1,CH2A2,CH2A3,CH2A4,CH2A5,CH2A6,CH2A7,
572 CH2B0,CH2B1,CH2B2,CH2B3,CH2B4,CH2B5,CH2B6,CH2B7,
573 CH2C0,CH2C1,CH2C2,CH2C3,CH2C4,CH2C5,CH2C6,CH2C7,
574 CH2D0,CH2D1,CH2D2,CH2D3,CH2D4,CH2D5,CH2D6,CH2D7,
575 CH2E0,CH2E1,CH2E2,CH2E3,CH2E4,CH2E5,CH2E6,CH2E7,
576 CH2F0,CH2F1,CH2F2,CH2F3,CH2F4,CH2F5,CH2F6,CH2F7,
577 CH300,CH301,CH302,CH303,CH304,CH305,CH306,CH307,
578 CH310,CH311,CH312,CH313,CH314,CH315,CH316,CH317,
579 CH320,CH321,CH322,CH323,CH324,CH325,CH326,CH327,
580 CH330,CH331,CH332,CH333,CH334,CH335,CH336,CH337,
581 CH340,CH341,CH342,CH343,CH344,CH345,CH346,CH347,
582 CH350,CH351,CH352,CH353,CH354,CH355,CH356,CH357,
583 CH360,CH361,CH362,CH363,CH364,CH365,CH366,CH367,
584 CH370,CH371,CH372,CH373,CH374,CH375,CH376,CH377,
585 CH380,CH381,CH382,CH383,CH384,CH385,CH386,CH387,
586 CH390,CH391,CH392,CH393,CH394,CH395,CH396,CH397,
587 CH3A0,CH3A1,CH3A2,CH3A3,CH3A4,CH3A5,CH3A6,CH3A7,
588 CH3B0,CH3B1,CH3B2,CH3B3,CH3B4,CH3B5,CH3B6,CH3B7,
589 CH3C0,CH3C1,CH3C2,CH3C3,CH3C4,CH3C5,CH3C6,CH3C7,
590 CH3D0,CH3D1,CH3D2,CH3D3,CH3D4,CH3D5,CH3D6,CH3D7,
591 CH3E0,CH3E1,CH3E2,CH3E3,CH3E4,CH3E5,CH3E6,CH3E7,
592 CH3F0,CH3F1,CH3F2,CH3F3,CH3F4,CH3F5,CH3F6,CH3F7,
593 CH400,CH401,CH402,CH403,CH404,CH405,CH406,CH407,
594 CH070,CH071,CH072,CH073,CH074,CH075,CH076,CH077,
595 CH8150,CH8151,CH8152,CH8153,CH8154,CH8155,CH8156,CH8157,
596 CH16230,CH16231,CH16232,CH16233,CH16234,CH16235,CH16236,CH16237,
597 CH24310,CH24311,CH24312,CH24313,CH24314,CH24315,CH24316,CH24317,
598 CH31380,CH31381,CH31382,CH31383,CH31384,CH31385,CH31386,CH31387,
599 CH39460,CH39461,CH39462,CH39463,CH39464,CH39465,CH39466,CH39467,
600 CH47540,CH47541,CH47542,CH47543,CH47544,CH47545,CH47546,CH47547,
601 CH55620,CH55621,CH55622,CH55623,CH55624,CH55625,CH55626,CH55627,
602 CH0,CH1,CH2,CH3,CH4,CH5,CH6,CH7,
603 CH64710,CH64711,CH64712,CH64713,CH64714,CH64715,CH64716,CH64717,
604 CH72790,CH72791,CH72792,CH72793,CH72794,CH72795,CH72796,CH72797,
605 CH80870,CH80871,CH80872,CH80873,CH80874,CH80875,CH80876,CH80877,
606 CH88950,CH88951,CH88952,CH88953,CH88954,CH88955,CH88956,CH88957,
607 CH961030,CH961031,CH961032,CH961033,CH961034,CH961035,CH961036,CH961037,
608 CH1041110,CH1041111,CH1041112,CH1041113,CH1041114,CH1041115,CH1041116,CH1041117,
609 CH1121190,CH1121191,CH1121192,CH1121193,CH1121194,CH1121195,CH1121196,CH1121197,
610 CH1201270,CH1201271,CH1201272,CH1201273,CH1201274,CH1201275,CH1201276,CH1201277,
611 CH1281350,CH1281351,CH1281352,CH1281353,CH1281354,CH1281355,CH1281356,CH1281357,
612 CH1361430,CH1361431,CH1361432,CH1361433,CH1361434,CH1361435,CH1361436,CH1361437,
613 CH1441510,CH1441511,CH1441512,CH1441513,CH1441514,CH1441515,CH1441516,CH1441517,
614 CH1521590,CH1521591,CH1521592,CH1521593,CH1521594,CH1521595,CH1521596,CH1521597,
615 CH1601670,CH1601671,CH1601672,CH1601673,CH1601674,CH1601675,CH1601676,CH1601677,
616 CH1681750,CH1681751,CH1681752,CH1681753,CH1681754,CH1681755,CH1681756,CH1681757,
617 CH1761830,CH1761831,CH1761832,CH1761833,CH1761834,CH1761835,CH1761836,CH1761837,
618 CH1841910,CH1841911,CH1841912,CH1841913,CH1841914,CH1841915,CH1841916,CH1841917,
619 CH1921990,CH1921991,CH1921992,CH1921993,CH1921994,CH1921995,CH1921996,CH1921997};
620 
621 //END letter def
622 
623 
624 
625 void setup(){
626      
627   pinMode(A_pin, OUTPUT); 
628   pinMode(B_pin, OUTPUT);
629   pinMode(C_pin, OUTPUT);
630   pinMode(D_pin, OUTPUT);
631   
632   pinMode(G1_pin, OUTPUT);
633   pinMode(G2_pin, OUTPUT);
634   pinMode(R1_pin, OUTPUT);
635   pinMode(R2_pin, OUTPUT);
636   
637   pinMode(S_pin, OUTPUT); 
638   pinMode(L_pin, OUTPUT); 
639   pinMode(E_pin, OUTPUT);
640   
641   Serial.begin(9600);
642   
643 }
644 
645 void loop(){
646 
647    
648  //  PORTD |= 0x12;
649   // PORTD |= 0x13; 
650   PORTD |= 0x08;
651  //  digitalWrite(G1_pin, HIGH); // PIN 6
652  //  digitalWrite(G2_pin, HIGH); // PIN 7
653   // PORTB |= 0x17;
654   PORTB |= 0x18;
655 //  PORTB &= ~0x18;
656   // digitalWrite(R1_pin, HIGH); // PIN 11
657   // digitalWrite(R2_pin, HIGH); // PIN 12
658 
659 
660   while(1){
661     
662     for(int j=0;j<16;j++){ // start a line scan
663        spi_number(j, G2_pin);
664     }
665   }
666 }
667 
668 
669 // Additional functions
670 
671 void spi_number(int row, int MOUT) {
672 
673   // function to transfer a char to the SPI inteface
674   
675   int div, imp, j;
676     
677   int str_pos;
678   int prev_str_pos;
679   
680   PORTB |= 0x03;
681   sel_row(row % 16);
682  
683   PORTB &= 0xfc;
684   
685   for(int i = 1; i <=64; i++) { // setup a scan of 64 iterations to find out the column led
686      str_pos= (i/8)+ ((row/8)*8);
687      
688 
689      if(sizeof(STRING) -1 > str_pos){         
690        if(prev_str_pos != str_pos){
691          //Serial.println(STRING[str_pos]);
692          get_buffer(STRING[str_pos]);
693          prev_str_pos = str_pos;
694        }  
695      }else if(sizeof(STRING) -1 == str_pos){
696          null_buffer();
697          //print_buffer();      
698      }
699      if(((int)(buffer[row%8][(i)%8]) == 48) && (sizeof(STRING) -1 > str_pos)) //48 = 0 in ASCII
700        digitalWrite(MOUT, LOW);
701      else  
702        digitalWrite(MOUT, HIGH); 
703      /*
704      digitalWrite(S_pin,LOW);
705      digitalWrite(S_pin,HIGH);
706      */
707      PORTB &= 0xfe;
708      PORTB |= 0x01;
709 }
710   PORTB &= 0xfd;
711   PORTB |= 0x02;
712 
713 }
714 
715 void sel_row(int row){
716   PORTD &= 0xC0;
717   PORTD |= (row<<2);
718 }
719 
720 void get_buffer(char chr){
721 
722   for(int i=0; i<sizeof(chl); i++){
723   
724     if(chl[i] == chr){     
725     
726         int pos = i*8;
727         
728         for(int j=0;j<8;j++){
729     
730         strcpy_P(buffer[j], (PGM_P)pgm_read_word(&(CHL[j+pos])));
731        
732         }
733     
734     }
735     
736   }
737 
738 }
739 
740 
741 void null_buffer(){
742 
743   for(int i=0;i<8;i++)
744     for(int j=0; j<8;j++)
745       buffer[i][j] = 0;
746 
747 }