close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_core.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Feb 26, 2010, 11:56:30 AM (16 years ago)
- Author:
-
wade
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
|
v3
|
v4
|
|
| 10 | 10 | */ |
| 11 | 11 | // display array size |
| 12 | | #define display_array_size 64 |
| | 12 | #define display_array_size 128 |
| 13 | 13 | // ascii 5x7 dot font |
| | 14 | #define data_null 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // null char |
| 14 | 15 | #define data_ascii_A 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, 0x00, 0x00 // A 65 |
| 15 | 16 | #define data_ascii_R 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00 // R 82 |
| … |
… |
|
| 23 | 24 | // display array |
| 24 | 25 | byte data_ascii[][display_array_size] = { |
| | 26 | data_null, |
| | 27 | data_null, |
| | 28 | data_null, |
| | 29 | data_null, |
| 25 | 30 | data_ascii_A, |
| 26 | 31 | data_ascii_R, |
| … |
… |
|
| 30 | 35 | data_ascii_N, |
| 31 | 36 | data_ascii_O, |
| 32 | | data_ascii_colon |
| | 37 | data_ascii_colon, |
| | 38 | data_null, |
| | 39 | data_null, |
| | 40 | data_null, |
| | 41 | data_null, |
| 33 | 42 | }; |
| 34 | 43 | |
| 35 | 44 | // Pin connected to ST_CP of 74HC595 for scanning |
| 36 | | int scan_latch_pin = 5; |
| | 45 | int scan_latch_pin = 5; // 白 |
| 37 | 46 | // Pin connected to SH_CP of 74HC595 for scanning |
| 38 | | int scan_clock_pin = 6; |
| | 47 | int scan_clock_pin = 6; // 藍 |
| 39 | 48 | // Pin connected to DS of 74HC595 for scanning |
| 40 | | int scan_data_pin = 7; |
| | 49 | int scan_data_pin = 7; // 棕 |
| 41 | 50 | |
| 42 | 51 | |
| … |
… |
|
| 53 | 62 | |
| 54 | 63 | void loop() { |
| 55 | | for (int i = 1; i < (display_array_size - 8); i++ ) |
| 56 | | display_led_from(i, 100); |
| | 64 | for (int i = 1; i < (display_array_size - 32); i++ ) |
| | 65 | display_led_from(i, 25); |
| 57 | 66 | } |
| 58 | 67 | |
| … |
… |
|
| 66 | 75 | digitalWrite(scan_latch_pin, LOW); |
| 67 | 76 | |
| | 77 | |
| 68 | 78 | //the data of second LED Matrix |
| 69 | 79 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF)); |
| 70 | 80 | //shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(1 << (j-index))); |
| 71 | | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+24] )); |
| | 81 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j] )); |
| | 82 | |
| | 83 | //the data of second LED Matrix |
| | 84 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF)); |
| | 85 | //shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(1 << (j-index))); |
| | 86 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+8] )); |
| 72 | 87 | |
| 73 | 88 | //the data of second LED Matrix |
| … |
… |
|
| 76 | 91 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+16] )); |
| 77 | 92 | |
| 78 | | //the data of second LED Matrix |
| 79 | | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF)); |
| 80 | | //shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(1 << (j-index))); |
| 81 | | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+8] )); |
| 82 | 93 | |
| 83 | 94 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF)); |
| 84 | 95 | //shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int( (1 << (j-index)) ) ); |
| 85 | | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j] )); |
| | 96 | shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+24] )); |
| 86 | 97 | |
| 87 | 98 | |
| … |
… |
|
| 113 | 124 | |
| 114 | 125 | }}} |
| | 126 | |
| | 127 | 範例影片: |
| | 128 | * http://www.youtube.com/watch?v=4kMsGaIsSck |