8X8 Dot Matrix Led Display & Arduino Mega

Used Products:

1. 8X8 Dot Matrix Led Display
2. Arduino Mega 2560

Used Libraries:

1. FrequencyTimer2

Code:

#include <FrequencyTimer2.h> byte T[8] = { B11111111, B11111111, B00011000, B00011000, B00011000, B00011000, B00011000, B00011000 }; byte U[8] = { B11000011, B11000011, B11000011, B11000011, B11000011, B11000011, B11111111, B11111111 }; byte R[8] = { B11111110, B11111111, B11000111, B11000110, B11111110, B11111111, B11000011, B11000011 }; byte K[8] = { B11000011, B11000111, B11001110, B11111100, B11111110, B11100111, B11000011, B11000011 }; byte M[8] = { B11000011, B11100111, B11111111, B11111111, B11011011, B11000011, B11000011, B11000011 }; byte E[8] = { B11111111, B11111111, B11000000, B11111110, B11111110, B11000000, B11111111, B11111111 }; byte N[8] = { B11000011, B11100011, B11110011, B11111011, B11011111, B11001111, B11000111, B11000011 }; byte I[8] = { B00011000, B00000000, B00011000, B00011000, B00011000, B00011000, B00011000, B00011000 }; byte S[8] = { B01111110, B11111111, B11000000, B11111110, B11111111, B00000011, B11111111, B01111110 }; byte A[8] = { B00111100, B01111110, B11000011, B11000011, B11111111, B11111111, B11000011, B11000011 }; int numPatterns = 12; byte *letters[12] = {T,U,R,K,M,E,N,I,S,T,A,N}; int pattern = 0; byte col = 0; int cols[8] = {46,49,47,40,43,42,50,52}; int rows[8] = {38,48,39,44,53,41,51,45}; //const int ARRAY_SIZE = sizeof(rows) / sizeof(int); void setup() { for (int i = 0; i < 8; i++) { pinMode(cols[i], OUTPUT); pinMode(rows[i], OUTPUT); } FrequencyTimer2::disable(); FrequencyTimer2::setPeriod(2000); FrequencyTimer2::setOnOverflow(display); } void loop() { delay(800); pattern = ++pattern % numPatterns; } void display() { digitalWrite(cols[col], 1); col = ++col % 8; byte mask; byte data = letters[pattern][col]; for (int i = 0; i < 8; i++) { mask = 0x01 << i; digitalWrite(rows[i], !!(data&mask)); } digitalWrite(cols[col], 0); }