Changes between Version 3 and Version 4 of wade/embedded/arduino/example/example_3-3


Ignore:
Timestamp:
Feb 26, 2010, 11:56:30 AM (15 years ago)
Author:
wade
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • wade/embedded/arduino/example/example_3-3

    v3 v4  
    1010 */
    1111// display array size
    12 #define display_array_size 64
     12#define display_array_size 128
    1313// ascii 5x7 dot font
     14#define data_null 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // null char
    1415#define data_ascii_A 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, 0x00, 0x00  // A 65
    1516#define data_ascii_R 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00  // R 82
     
    2324// display array
    2425byte data_ascii[][display_array_size] = {
     26                       data_null,
     27                       data_null,
     28                       data_null,
     29                       data_null,
    2530                       data_ascii_A,
    2631                       data_ascii_R,
     
    3035                       data_ascii_N,
    3136                       data_ascii_O,
    32                        data_ascii_colon
     37                       data_ascii_colon,
     38                       data_null,
     39                       data_null,
     40                       data_null,
     41                       data_null,
    3342                       };
    3443
    3544// Pin connected to ST_CP of 74HC595 for scanning
    36 int scan_latch_pin = 5;
     45int scan_latch_pin = 5; // 白
    3746// Pin connected to SH_CP of 74HC595 for scanning
    38 int scan_clock_pin = 6;
     47int scan_clock_pin = 6; // 藍
    3948// Pin connected to DS of 74HC595 for scanning
    40 int scan_data_pin = 7;
     49int scan_data_pin = 7; // 棕
    4150
    4251
     
    5362
    5463void 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);
    5766}
    5867
     
    6675      digitalWrite(scan_latch_pin, LOW);
    6776     
     77     
    6878      //the data of second LED Matrix
    6979      shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF));     
    7080      //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] ));
    7287     
    7388      //the data of second LED Matrix
     
    7691      shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, int(data_ascii[0][j+16] ));
    7792     
    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] ));
    8293     
    8394      shiftOut(scan_data_pin, scan_clock_pin, MSBFIRST, byte((1 << (j-index)) ^ 0xFF));
    8495      //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] ));
    8697     
    8798
     
    113124
    114125}}}
     126
     127範例影片:
     128 * http://www.youtube.com/watch?v=4kMsGaIsSck