例程12-8乘8点阵精要
第12讲 8乘8点阵 8X8点阵共由64个发光二极管组成,且每个发光二极管是放置在行线和列线的交叉点上,当对应的某一行置1电平,某一列置0电平,则相应的二极管就亮;如要将第一个点点亮,则9脚接高电平13脚接低电平,则第一个点就亮了;如果要将第一行点亮,则第9脚要接高电平,而(13、3、4、10、6、11、15、16)这些引脚接低电平,那么第一行就会点亮;如要将第一列点亮,则第13脚接低电平,而(9、14、8、12、1、7、2、5)接高电平,那么第一列就会点亮。 引号脚识别:点阵模块4条边,有一边上有丝印,且中间向下有塑料突起;插针向下放置,丝印面向自己,左起为1号脚,逆时针排列。只要其对应的行接高,列接低,即可点亮响应行列的LED。应用时需加限流电阻。 所示是引脚和对应的行列序号,R表示行,C表示列。引脚逆时针排列: 号。依此类推,只要每行数据显示时间间隔够短,利用人眼的视觉暂停作用,这样送16次数据扫描完16行后就会看到一个“0”;第二种送数据的方法是字模信号送到行线上再扫描列线也是同样的道理。同样以“0”来说明,16行(9、14、8、12、1、7、2、5)上送(0000000000000000,0x00,0x00)而第一列(13脚)送、“0”。同理扫描第二列。当行线上送了16次数据而列线扫描了16次后一个“0”也就显示出来了。因此,形成的列代码为 00H,00H,3EH,41H,41H,3EH,00H,00H;只要把这些代码分别依次送到相应的列线上面,即可实现“0”的数字显示。 参考例程 //the pin to control ROW //arduino 引脚 //led 点阵引脚 const int row1 = 2; // the number of the row pin 9 const int row2 = 3; // the number of the row pin 14 const int row3 = 4; // the number of the row pin 8 const int row4 = 5; // the number of the row pin 12 const int row5 = 17; // the number of the row pin 1 const int row6 = 16; // the number of the row pin 7 const int row7 = 15; // the number of the row pin 2 const int row8 = 14; // the number of the row pin 5 //the pin to control COl const int col1 = 6; // the number of the col pin 13 const int col2 = 7; // the number of the col pin 3 const int col3 = 8; // the number of the col pin 4 const int col4 = 9; // the number of the col pin 10 const int col5 = 10; // the number of the col pin 6 const int col6 = 11; // the number of the col pin 11 const int col7 = 12; // the number of the col pin 15 const int col8 = 13; // the number of the col pin 16 void setup(){ int i = 0 ; for(i=2;i18;i++) { pinMode(i, OUTPUT); } pinMode(row5, OUTPUT); pinMode(row6, OUTPUT); pinMode(row7, OUTPUT); pinMode(row8, OUTPUT); for(i=2;i18;i++) { digitalWrite(i, LOW); } digitalWrite(row5, LOW); digitalWrite(row6, LOW); digitalWrite(row7, LOW); digitalWrite(row8, LOW); } void loop(){ int i; //the row # 1 and col # 1 of the LEDs turn on digitalWrite(row1, HI
原创力文档

文档评论(0)