Components and supplies
USB Cable - Standard A-B for ARDUINO
Breadboard (generic)
Arduino UNO
Jumper wires (generic)
8x8 LED Matrix
Apps and platforms
Arduino IDE
Project description
Code
Here's the code
arduino
1//update from SAnwandter 2 3#define ROW_1 2 4#define ROW_2 3 5#define ROW_3 4 6#define ROW_4 5 7#define ROW_5 6 8#define ROW_6 7 9#define ROW_7 8 10#define ROW_8 9 11 12#define COL_1 10 13#define COL_2 11 14#define COL_3 12 15#define COL_4 13 16#define COL_5 A0 17#define COL_6 A1 18#define COL_7 A2 19#define COL_8 A3 20 21const byte rows[] = { 22 ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8 23}; 24const byte col[] = { 25 COL_1,COL_2, COL_3, COL_4, COL_5, COL_6, COL_7, COL_8 26}; 27 28// The display buffer 29// It's prefilled with a smiling face (1 = ON, 0 = OFF) 30byte ALL[] = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111}; 31byte EX[] = {B00000000,B00010000,B00010000,B00010000,B00010000,B00000000,B00010000,B00000000}; 32byte A[] = { B00000000,B00111100,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110}; 33byte B[] = {B01111000,B01001000,B01001000,B01110000,B01001000,B01000100,B01000100,B01111100}; 34byte C[] = {B00000000,B00011110,B00100000,B01000000,B01000000,B01000000,B00100000,B00011110}; 35byte D[] = {B00000000,B00111000,B00100100,B00100010,B00100010,B00100100,B00111000,B00000000}; 36byte E[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00111100,B00000000}; 37byte F[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00100000,B00000000}; 38byte G[] = {B00000000,B00111110,B00100000,B00100000,B00101110,B00100010,B00111110,B00000000}; 39byte H[] = {B00000000,B00100100,B00100100,B00111100,B00100100,B00100100,B00100100,B00000000}; 40byte I[] = {B00000000,B00111000,B00010000,B00010000,B00010000,B00010000,B00111000,B00000000}; 41byte J[] = {B00000000,B00011100,B00001000,B00001000,B00001000,B00101000,B00111000,B00000000}; 42byte K[] = {B00000000,B00100100,B00101000,B00110000,B00101000,B00100100,B00100100,B00000000}; 43byte L[] = {B00000000,B00100000,B00100000,B00100000,B00100000,B00100000,B00111100,B00000000}; 44byte M[] = {B00000000,B00000000,B01000100,B10101010,B10010010,B10000010,B10000010,B00000000}; 45byte N[] = {B00000000,B00100010,B00110010,B00101010,B00100110,B00100010,B00000000,B00000000}; 46byte O[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000010,B00111100,B00000000}; 47byte P[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100000,B00100000,B00000000}; 48byte Q[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000110,B00111110,B00000001}; 49byte R[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100100,B00100100,B00000000}; 50byte S[] = {B00000000,B00111100,B00100000,B00111100,B00000100,B00000100,B00111100,B00000000}; 51byte T[] = {B00000000,B01111100,B00010000,B00010000,B00010000,B00010000,B00010000,B00000000}; 52byte U[] = {B00000000,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000,B00000000}; 53byte V[] = {B00000000,B00100010,B00100010,B00100010,B00010100,B00010100,B00001000,B00000000}; 54byte W[] = {B00000000,B10000010,B10010010,B01010100,B01010100,B00101000,B00000000,B00000000}; 55byte X[] = {B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000}; 56byte Y[] = {B00000000,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00000000}; 57byte Z[] = {B00000000,B00111100,B00000100,B00001000,B00010000,B00100000,B00111100,B00000000}; 58 59float timeCount = 0; 60 61void setup() 62{ 63 // Open serial port 64 Serial.begin(9600); 65 66 // Set all used pins to OUTPUT 67 // This is very important! If the pins are set to input 68 // the display will be very dim. 69 for (byte i = 2; i <= 13; i++) 70 pinMode(i, OUTPUT); 71 pinMode(A0, OUTPUT); 72 pinMode(A1, OUTPUT); 73 pinMode(A2, OUTPUT); 74 pinMode(A3, OUTPUT); 75} 76 77void loop() { 78 // This could be rewritten to not use a delay, which would make it appear brighter 79delay(5); 80timeCount += 1; 81 82if(timeCount < 20) 83{ 84drawScreen(A); 85} 86else if (timeCount < 40) 87{ 88drawScreen(R); 89} 90else if (timeCount < 60) 91{ 92drawScreen(D); 93} 94else if (timeCount < 80) 95{ 96drawScreen(U); 97} 98else if (timeCount < 100) 99{ 100drawScreen(I); 101} 102else if (timeCount < 120) 103{ 104drawScreen(N); 105} 106else if (timeCount < 140) { 107 drawScreen(O); 108} 109else if (timeCount < 160) 110{ 111drawScreen(ALL); 112} 113else if (timeCount < 180) 114{ 115drawScreen(ALL); 116} 117else { 118// back to the start 119timeCount = 0; 120} 121} 122 void drawScreen(byte buffer2[]) 123 { 124 // Turn on each row in series 125 for (byte i = 0; i < 8; i++) // count next row 126 { 127 digitalWrite(rows[i], HIGH); //initiate whole row 128 for (byte a = 0; a < 8; a++) // count next row 129 { 130 // if You set (~buffer2[i] >> a) then You will have positive 131 digitalWrite(col[a], (buffer2[i] >> a) & 0x01); // initiate whole column 132 133 delayMicroseconds(100); // uncoment deley for diferent speed of display 134 //delayMicroseconds(1000); 135 //delay(10); 136 //delay(100); 137 138 digitalWrite(col[a], 1); // reset whole column 139 } 140 digitalWrite(rows[i], LOW); // reset whole row 141 // otherwise last row will intersect with next row 142 } 143} 144// 145 /* this is siplest resemplation how for loop is working with each row. 146 digitalWrite(COL_1, (~b >> 0) & 0x01); // Get the 1st bit: 10000000 147 digitalWrite(COL_2, (~b >> 1) & 0x01); // Get the 2nd bit: 01000000 148 digitalWrite(COL_3, (~b >> 2) & 0x01); // Get the 3rd bit: 00100000 149 digitalWrite(COL_4, (~b >> 3) & 0x01); // Get the 4th bit: 00010000 150 digitalWrite(COL_5, (~b >> 4) & 0x01); // Get the 5th bit: 00001000 151 digitalWrite(COL_6, (~b >> 5) & 0x01); // Get the 6th bit: 00000100 152 digitalWrite(COL_7, (~b >> 6) & 0x01); // Get the 7th bit: 00000010 153 digitalWrite(COL_8, (~b >> 7) & 0x01); // Get the 8th bit: 00000001 154}*/
Here's the code
arduino
1//update from SAnwandter 2 3#define ROW_1 2 4#define ROW_2 3 5#define ROW_3 4 6#define ROW_4 5 7#define ROW_5 6 8#define ROW_6 7 9#define ROW_7 8 10#define ROW_8 9 11 12#define COL_1 10 13#define COL_2 11 14#define COL_3 12 15#define COL_4 13 16#define COL_5 A0 17#define COL_6 A1 18#define COL_7 A2 19#define COL_8 A3 20 21const byte rows[] = { 22 ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8 23}; 24const byte col[] = { 25 COL_1,COL_2, COL_3, COL_4, COL_5, COL_6, COL_7, COL_8 26}; 27 28// The display buffer 29// It's prefilled with a smiling face (1 = ON, 0 = OFF) 30byte ALL[] = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111}; 31byte EX[] = {B00000000,B00010000,B00010000,B00010000,B00010000,B00000000,B00010000,B00000000}; 32byte A[] = { B00000000,B00111100,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110}; 33byte B[] = {B01111000,B01001000,B01001000,B01110000,B01001000,B01000100,B01000100,B01111100}; 34byte C[] = {B00000000,B00011110,B00100000,B01000000,B01000000,B01000000,B00100000,B00011110}; 35byte D[] = {B00000000,B00111000,B00100100,B00100010,B00100010,B00100100,B00111000,B00000000}; 36byte E[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00111100,B00000000}; 37byte F[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00100000,B00000000}; 38byte G[] = {B00000000,B00111110,B00100000,B00100000,B00101110,B00100010,B00111110,B00000000}; 39byte H[] = {B00000000,B00100100,B00100100,B00111100,B00100100,B00100100,B00100100,B00000000}; 40byte I[] = {B00000000,B00111000,B00010000,B00010000,B00010000,B00010000,B00111000,B00000000}; 41byte J[] = {B00000000,B00011100,B00001000,B00001000,B00001000,B00101000,B00111000,B00000000}; 42byte K[] = {B00000000,B00100100,B00101000,B00110000,B00101000,B00100100,B00100100,B00000000}; 43byte L[] = {B00000000,B00100000,B00100000,B00100000,B00100000,B00100000,B00111100,B00000000}; 44byte M[] = {B00000000,B00000000,B01000100,B10101010,B10010010,B10000010,B10000010,B00000000}; 45byte N[] = {B00000000,B00100010,B00110010,B00101010,B00100110,B00100010,B00000000,B00000000}; 46byte O[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000010,B00111100,B00000000}; 47byte P[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100000,B00100000,B00000000}; 48byte Q[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000110,B00111110,B00000001}; 49byte R[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100100,B00100100,B00000000}; 50byte S[] = {B00000000,B00111100,B00100000,B00111100,B00000100,B00000100,B00111100,B00000000}; 51byte T[] = {B00000000,B01111100,B00010000,B00010000,B00010000,B00010000,B00010000,B00000000}; 52byte U[] = {B00000000,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000,B00000000}; 53byte V[] = {B00000000,B00100010,B00100010,B00100010,B00010100,B00010100,B00001000,B00000000}; 54byte W[] = {B00000000,B10000010,B10010010,B01010100,B01010100,B00101000,B00000000,B00000000}; 55byte X[] = {B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000}; 56byte Y[] = {B00000000,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00000000}; 57byte Z[] = {B00000000,B00111100,B00000100,B00001000,B00010000,B00100000,B00111100,B00000000}; 58 59float timeCount = 0; 60 61void setup() 62{ 63 // Open serial port 64 Serial.begin(9600); 65 66 // Set all used pins to OUTPUT 67 // This is very important! If the pins are set to input 68 // the display will be very dim. 69 for (byte i = 2; i <= 13; i++) 70 pinMode(i, OUTPUT); 71 pinMode(A0, OUTPUT); 72 pinMode(A1, OUTPUT); 73 pinMode(A2, OUTPUT); 74 pinMode(A3, OUTPUT); 75} 76 77void loop() { 78 // This could be rewritten to not use a delay, which would make it appear brighter 79delay(5); 80timeCount += 1; 81 82if(timeCount < 20) 83{ 84drawScreen(A); 85} 86else if (timeCount < 40) 87{ 88drawScreen(R); 89} 90else if (timeCount < 60) 91{ 92drawScreen(D); 93} 94else if (timeCount < 80) 95{ 96drawScreen(U); 97} 98else if (timeCount < 100) 99{ 100drawScreen(I); 101} 102else if (timeCount < 120) 103{ 104drawScreen(N); 105} 106else if (timeCount < 140) { 107 drawScreen(O); 108} 109else if (timeCount < 160) 110{ 111drawScreen(ALL); 112} 113else if (timeCount < 180) 114{ 115drawScreen(ALL); 116} 117else { 118// back to the start 119timeCount = 0; 120} 121} 122 void drawScreen(byte buffer2[]) 123 { 124 // Turn on each row in series 125 for (byte i = 0; i < 8; i++) // count next row 126 { 127 digitalWrite(rows[i], HIGH); //initiate whole row 128 for (byte a = 0; a < 8; a++) // count next row 129 { 130 // if You set (~buffer2[i] >> a) then You will have positive 131 digitalWrite(col[a], (buffer2[i] >> a) & 0x01); // initiate whole column 132 133 delayMicroseconds(100); // uncoment deley for diferent speed of display 134 //delayMicroseconds(1000); 135 //delay(10); 136 //delay(100); 137 138 digitalWrite(col[a], 1); // reset whole column 139 } 140 digitalWrite(rows[i], LOW); // reset whole row 141 // otherwise last row will intersect with next row 142 } 143} 144// 145 /* this is siplest resemplation how for loop is working with each row. 146 digitalWrite(COL_1, (~b >> 0) & 0x01); // Get the 1st bit: 10000000 147 digitalWrite(COL_2, (~b >> 1) & 0x01); // Get the 2nd bit: 01000000 148 digitalWrite(COL_3, (~b >> 2) & 0x01); // Get the 3rd bit: 00100000 149 digitalWrite(COL_4, (~b >> 3) & 0x01); // Get the 4th bit: 00010000 150 digitalWrite(COL_5, (~b >> 4) & 0x01); // Get the 5th bit: 00001000 151 digitalWrite(COL_6, (~b >> 5) & 0x01); // Get the 6th bit: 00000100 152 digitalWrite(COL_7, (~b >> 6) & 0x01); // Get the 7th bit: 00000010 153 digitalWrite(COL_8, (~b >> 7) & 0x01); // Get the 8th bit: 00000001 154}*/
Downloadable files
Connections diagram
This is to make the connections easier
Connections diagram
Comments
Only logged in users can leave comments