From 184d9fb656b75534b5a4173f437db30d36e21b67 Mon Sep 17 00:00:00 2001 From: Alexander Kauerz Date: Fri, 4 Nov 2011 00:23:50 +0100 Subject: Quelltestdateien wurden mundfein gemacht. --- .gitignore | 2 +- Matrix-3x3/Matrix-3x3.pde | 57 --------------- Matrix-5x6/Matrix-5x6.pde | 174 -------------------------------------------- Matrix-7x13/Matrix-7x13.pde | 125 ------------------------------- Matrix_3x3/Matrix_3x3.pde | 57 +++++++++++++++ Matrix_5x6/Matrix_5x6.pde | 174 ++++++++++++++++++++++++++++++++++++++++++++ Matrix_7x13/Matrix_7x13.pde | 125 +++++++++++++++++++++++++++++++ 7 files changed, 357 insertions(+), 357 deletions(-) delete mode 100644 Matrix-3x3/Matrix-3x3.pde delete mode 100644 Matrix-5x6/Matrix-5x6.pde delete mode 100644 Matrix-7x13/Matrix-7x13.pde create mode 100644 Matrix_3x3/Matrix_3x3.pde create mode 100644 Matrix_5x6/Matrix_5x6.pde create mode 100644 Matrix_7x13/Matrix_7x13.pde diff --git a/.gitignore b/.gitignore index 5ca0973..f992aa8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .DS_Store - +.arduino-0022 diff --git a/Matrix-3x3/Matrix-3x3.pde b/Matrix-3x3/Matrix-3x3.pde deleted file mode 100644 index eea52e5..0000000 --- a/Matrix-3x3/Matrix-3x3.pde +++ /dev/null @@ -1,57 +0,0 @@ -/* - Blink - - */ -#define ROW 3 -#define COL 0 -#define ROWCNT 3 -#define COLCNT 3 - -#define DELAY 3 - -int frame[3][3] = { - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0}, -}; - -int framenr = 0; -int rownr = 0; -void setup() { - // initialize the digital pin as an output. - int i; - for (i = 0;i < ROWCNT; i++) - pinMode(ROW + i, OUTPUT); - for (i = 0;i < COLCNT; i++) - pinMode(COL + i, OUTPUT); -} - -void nextFrame() { - frame[0][0] = (framenr % 100) < 50; - frame[0][1] = (framenr % 100) < 50; - frame[0][2] = (framenr % 100) < 50; - frame[1][0] = (framenr % 100) < 50; - frame[1][1] = (framenr % 100) >= 50; - frame[1][2] = (framenr % 100) < 50; - frame[2][0] = (framenr % 100) < 50; - frame[2][1] = (framenr % 100) < 50; - frame[2][2] = (framenr % 100) < 50; -} - -void loop() { - int i; - - rownr = ( rownr + 1 ) % ROWCNT; - - if (rownr == 0) { - framenr++; - nextFrame(); - } - - for (i = 0; i < COLCNT; i++) { - digitalWrite(COL + i, frame[rownr][i]); - } - digitalWrite(ROW + rownr, HIGH); - delay(DELAY); - digitalWrite(ROW + rownr, LOW); -} diff --git a/Matrix-5x6/Matrix-5x6.pde b/Matrix-5x6/Matrix-5x6.pde deleted file mode 100644 index 8f95209..0000000 --- a/Matrix-5x6/Matrix-5x6.pde +++ /dev/null @@ -1,174 +0,0 @@ -/* -5x6 LEDs Text scroller -Frank Bartels 2010 - */ - -#define leaner 1 // 0:std 1:normal 2:lean -//char myoutstring[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ "; -//char myoutstring[]="0123456789 "; -//char myoutstring[]="789"; -char myoutstring[]="TOPPOINT KIEL FRICKL 27C3 "; -int myoutstringpos=0; - -#define NledPins 6 -int ledPins[NledPins] = { 7,6,5,4,3,2 }; - -int i, j, k, x,y,xx,yy, lum=0,newscr=0,tmp; -int scrollx,scrolly; -#define SCRdx 5 -#define SCRdy 6 -#define OSf 4 // oversampling factor <=5, sonst Speicher voll! - -// int=2 ByteFRICKL FRICKL -int scr[SCRdx][SCRdy]; // (real) screen -int vscr[SCRdx*OSf][SCRdy*OSf]; // virtual (high res) screen - -#define CFONTwidth 0x5 // (font constant) -#define CFONTwidth2 0x7 // with std space between chars std=7 -#define CFONTstart 0x20 -#define CFONTend 0x5b -char cfont[]= -{ 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x21 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x22 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x23 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x24 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x25 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x26 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x27 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x29 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2a - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2b - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2c - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2d - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2e - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2f - //0x1e, 0x31, 0x29, 0x25, 0x1e, // 0x30 0 - 0x1e, 0x21, 0x2d, 0x21, 0x1e, // 0x30 0 - 0x00, 0x22, 0x3f, 0x20, 0x00, // 0x31 1 - 0x22, 0x31, 0x29, 0x29, 0x26, // 0x32 2 - 0x12, 0x21, 0x25, 0x25, 0x1a, // 0x33 3 - 0x18, 0x14, 0x12, 0x3f, 0x10, // 0x34 4 - 0x22, 0x25, 0x25, 0x25, 0x18, // 0x35 5 - //0x1e, 0x29, 0x29, 0x29, 0x1a, // 0x36 6 - 0x1e, 0x25, 0x25, 0x25, 0x18, // 0x36 6 - 0x01, 0x01, 0x31, 0x0d, 0x03, // 0x37 7 - 0x1a, 0x25, 0x25, 0x25, 0x1a, // 0x38 8 - 0x06, 0x29, 0x29, 0x29, 0x1e, // 0x39 9 - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3a - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3b - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3c - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3d - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3e - 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3f - - 0x00, 0x00, 0x00, 0x00, 0x00, // SPACE (0x40 or 0x20) - 0x38, 0x16, 0x11, 0x16, 0x38, // A (0x41) - 0x3f, 0x25, 0x25, 0x26, 0x18, // B (0x42) - 0x1e, 0x21, 0x21, 0x21, 0x12, // C - 0x3f, 0x21, 0x21, 0x21, 0x1e, // D - 0x3f, 0x25, 0x25, 0x25, 0x21, // E - 0x3f, 0x05, 0x05, 0x05, 0x01, // F - 0x1e, 0x21, 0x21, 0x29, 0x1a, // G - 0x3f, 0x08, 0x08, 0x08, 0x3f, // H - 0x00, 0x21, 0x3f, 0x21, 0x00, // I - 0x00, 0x11, 0x21, 0x1f, 0x00, // J - 0x3f, 0x08, 0x14, 0x14, 0x22, // K - 0x3f, 0x20, 0x20, 0x20, 0x20, // L - 0x3f, 0x02, 0x0c, 0x02, 0x3f, // M - 0x3f, 0x02, 0x04, 0x08, 0x3f, // N - 0x1e, 0x21, 0x21, 0x21, 0x1e, // O - 0x3f, 0x09, 0x09, 0x09, 0x06, // P - 0x1e, 0x21, 0x29, 0x11, 0x2e, // Q - 0x3f, 0x09, 0x09, 0x19, 0x26, // R - 0x22, 0x25, 0x25, 0x25, 0x18, // S - 0x01, 0x01, 0x3f, 0x01, 0x01, // T - 0x1f, 0x20, 0x20, 0x20, 0x1f, // U - 0x03, 0x0c, 0x30, 0x0c, 0x03, // V - 0x3f, 0x10, 0x0c, 0x10, 0x3f, // W - 0x31, 0x0a, 0x04, 0x0a, 0x31, // X - 0x01, 0x02, 0x3c, 0x02, 0x01, // Y - 0x31, 0x29, 0x25, 0x23, 0x21, // Z -}; - -volatile int dummy; - -void setup() -{ for (int i=0; i254) lum=0; - - int xx=-1; - int yy=-1; - for (int y=0; ylum2) // (real) screen - //if (scr[yy][xx]+48 lum2*13/16) // good for font scroll - { //digitalWrite(ledPins[x], LOW); // digitalWrite(ledPins[y], LOW); (ganz unten) - pinMode(ledPins[x], OUTPUT); - //for (int ll=0; ll!=10; ll++) for (int l=0; l!=0x7fff; l++) dummy=l; - for (int l=0; l!=0x80; l++) dummy=l; - pinMode(ledPins[x], INPUT); - } - } - pinMode(ledPins[y], INPUT); - digitalWrite(ledPins[y], LOW); - } -} diff --git a/Matrix-7x13/Matrix-7x13.pde b/Matrix-7x13/Matrix-7x13.pde deleted file mode 100644 index 377eda2..0000000 --- a/Matrix-7x13/Matrix-7x13.pde +++ /dev/null @@ -1,125 +0,0 @@ -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - This example code is in the public domain. - */ -#define ROW 3 -#define COL 0 -#define ROWCNT 7 -#define COLCNT 13 -#define CHARWIDTH 5 -#define FRAMELEN 10 - -#define DELAY 3 - -int frame[COLCNT][ROWCNT] = {0}; - -/*const int frame_A[ROWCNT][CHARWIDTH] = { - {0, 0, 1, 0, 0}, - {0, 0, 1, 0, 0}, - {0, 1, 0, 1, 0}, - {0, 1, 0, 1, 0}, - {1, 1, 1, 1, 1}, - {1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1}, -};*/ - -/*const int frame_C[CHARWIDTH][ROWCNT] = { - {0, 0, 1, 1, 1}, - {0, 1, 1, 0, 0}, - {1, 1, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 1, 0, 0, 0}, - {0, 1, 1, 0, 0}, - {0, 0, 1, 1, 1}, -}; - -const int frame_H[ROWCNT][CHARWIDTH] = { - {1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1}, - {1, 1, 1, 1, 1}, - {1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1}, -}; - -const int frame_L[ROWCNT][CHARWIDTH] = { - {1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {1, 1, 1, 1, 1}, -};*/ - -const int frame_MINUS[CHARWIDTH][ROWCNT] = { - {0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0}, -}; - -const int emptyCol[ROWCNT] = {0}; - -unsigned long int framenr = 0; -int rownr = 0; -void setup() { - // initialize the digital pin as an output. - // Pin 13 has an LED connected on most Arduino boards: - int i; - for (i = 0;i < ROWCNT; i++) - pinMode(ROW + i, OUTPUT); - for (i = 0;i < COLCNT; i++) - pinMode(COL + i, OUTPUT); -} - -void setCol(int c, const int data[ROWCNT]) { - int r; - - if (c > 0 && c <= COLCNT) { - for (r = 0; r < ROWCNT; r++) - frame[c][r] = data[r]; - } -} - -void setChar(int c, const int data[CHARWIDTH][ROWCNT]) { - int i; - for (i = 0; i < CHARWIDTH; i++) - setCol(c+i, data[i]); -} - -void clearFrame() { - int i = 0; - for (i = 0; i < COLCNT; i++) - setCol(i, emptyCol); -} - -void nextFrame() { - int c; - int f2 = (framenr/FRAMELEN) % (COLCNT+CHARWIDTH); - - clearFrame(); - setChar(COLCNT-f2, frame_MINUS); -} - -void loop() { - int i; - - rownr = ( rownr + 1 ) % ROWCNT; - - if (rownr == 0) { - framenr++; - nextFrame(); - } - - for (i = 0; i < COLCNT; i++) { - digitalWrite(COL + i, frame[rownr][i]); - } - digitalWrite(ROW + rownr, HIGH); - delay(DELAY); - digitalWrite(ROW + rownr, LOW); -} diff --git a/Matrix_3x3/Matrix_3x3.pde b/Matrix_3x3/Matrix_3x3.pde new file mode 100644 index 0000000..eea52e5 --- /dev/null +++ b/Matrix_3x3/Matrix_3x3.pde @@ -0,0 +1,57 @@ +/* + Blink + + */ +#define ROW 3 +#define COL 0 +#define ROWCNT 3 +#define COLCNT 3 + +#define DELAY 3 + +int frame[3][3] = { + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, +}; + +int framenr = 0; +int rownr = 0; +void setup() { + // initialize the digital pin as an output. + int i; + for (i = 0;i < ROWCNT; i++) + pinMode(ROW + i, OUTPUT); + for (i = 0;i < COLCNT; i++) + pinMode(COL + i, OUTPUT); +} + +void nextFrame() { + frame[0][0] = (framenr % 100) < 50; + frame[0][1] = (framenr % 100) < 50; + frame[0][2] = (framenr % 100) < 50; + frame[1][0] = (framenr % 100) < 50; + frame[1][1] = (framenr % 100) >= 50; + frame[1][2] = (framenr % 100) < 50; + frame[2][0] = (framenr % 100) < 50; + frame[2][1] = (framenr % 100) < 50; + frame[2][2] = (framenr % 100) < 50; +} + +void loop() { + int i; + + rownr = ( rownr + 1 ) % ROWCNT; + + if (rownr == 0) { + framenr++; + nextFrame(); + } + + for (i = 0; i < COLCNT; i++) { + digitalWrite(COL + i, frame[rownr][i]); + } + digitalWrite(ROW + rownr, HIGH); + delay(DELAY); + digitalWrite(ROW + rownr, LOW); +} diff --git a/Matrix_5x6/Matrix_5x6.pde b/Matrix_5x6/Matrix_5x6.pde new file mode 100644 index 0000000..8f95209 --- /dev/null +++ b/Matrix_5x6/Matrix_5x6.pde @@ -0,0 +1,174 @@ +/* +5x6 LEDs Text scroller +Frank Bartels 2010 + */ + +#define leaner 1 // 0:std 1:normal 2:lean +//char myoutstring[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ "; +//char myoutstring[]="0123456789 "; +//char myoutstring[]="789"; +char myoutstring[]="TOPPOINT KIEL FRICKL 27C3 "; +int myoutstringpos=0; + +#define NledPins 6 +int ledPins[NledPins] = { 7,6,5,4,3,2 }; + +int i, j, k, x,y,xx,yy, lum=0,newscr=0,tmp; +int scrollx,scrolly; +#define SCRdx 5 +#define SCRdy 6 +#define OSf 4 // oversampling factor <=5, sonst Speicher voll! + +// int=2 ByteFRICKL FRICKL +int scr[SCRdx][SCRdy]; // (real) screen +int vscr[SCRdx*OSf][SCRdy*OSf]; // virtual (high res) screen + +#define CFONTwidth 0x5 // (font constant) +#define CFONTwidth2 0x7 // with std space between chars std=7 +#define CFONTstart 0x20 +#define CFONTend 0x5b +char cfont[]= +{ 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x21 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x22 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x23 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x24 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x25 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x26 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x27 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x29 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2a + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2b + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2c + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2d + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2e + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2f + //0x1e, 0x31, 0x29, 0x25, 0x1e, // 0x30 0 + 0x1e, 0x21, 0x2d, 0x21, 0x1e, // 0x30 0 + 0x00, 0x22, 0x3f, 0x20, 0x00, // 0x31 1 + 0x22, 0x31, 0x29, 0x29, 0x26, // 0x32 2 + 0x12, 0x21, 0x25, 0x25, 0x1a, // 0x33 3 + 0x18, 0x14, 0x12, 0x3f, 0x10, // 0x34 4 + 0x22, 0x25, 0x25, 0x25, 0x18, // 0x35 5 + //0x1e, 0x29, 0x29, 0x29, 0x1a, // 0x36 6 + 0x1e, 0x25, 0x25, 0x25, 0x18, // 0x36 6 + 0x01, 0x01, 0x31, 0x0d, 0x03, // 0x37 7 + 0x1a, 0x25, 0x25, 0x25, 0x1a, // 0x38 8 + 0x06, 0x29, 0x29, 0x29, 0x1e, // 0x39 9 + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3a + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3b + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3c + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3d + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3e + 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3f + + 0x00, 0x00, 0x00, 0x00, 0x00, // SPACE (0x40 or 0x20) + 0x38, 0x16, 0x11, 0x16, 0x38, // A (0x41) + 0x3f, 0x25, 0x25, 0x26, 0x18, // B (0x42) + 0x1e, 0x21, 0x21, 0x21, 0x12, // C + 0x3f, 0x21, 0x21, 0x21, 0x1e, // D + 0x3f, 0x25, 0x25, 0x25, 0x21, // E + 0x3f, 0x05, 0x05, 0x05, 0x01, // F + 0x1e, 0x21, 0x21, 0x29, 0x1a, // G + 0x3f, 0x08, 0x08, 0x08, 0x3f, // H + 0x00, 0x21, 0x3f, 0x21, 0x00, // I + 0x00, 0x11, 0x21, 0x1f, 0x00, // J + 0x3f, 0x08, 0x14, 0x14, 0x22, // K + 0x3f, 0x20, 0x20, 0x20, 0x20, // L + 0x3f, 0x02, 0x0c, 0x02, 0x3f, // M + 0x3f, 0x02, 0x04, 0x08, 0x3f, // N + 0x1e, 0x21, 0x21, 0x21, 0x1e, // O + 0x3f, 0x09, 0x09, 0x09, 0x06, // P + 0x1e, 0x21, 0x29, 0x11, 0x2e, // Q + 0x3f, 0x09, 0x09, 0x19, 0x26, // R + 0x22, 0x25, 0x25, 0x25, 0x18, // S + 0x01, 0x01, 0x3f, 0x01, 0x01, // T + 0x1f, 0x20, 0x20, 0x20, 0x1f, // U + 0x03, 0x0c, 0x30, 0x0c, 0x03, // V + 0x3f, 0x10, 0x0c, 0x10, 0x3f, // W + 0x31, 0x0a, 0x04, 0x0a, 0x31, // X + 0x01, 0x02, 0x3c, 0x02, 0x01, // Y + 0x31, 0x29, 0x25, 0x23, 0x21, // Z +}; + +volatile int dummy; + +void setup() +{ for (int i=0; i254) lum=0; + + int xx=-1; + int yy=-1; + for (int y=0; ylum2) // (real) screen + //if (scr[yy][xx]+48 lum2*13/16) // good for font scroll + { //digitalWrite(ledPins[x], LOW); // digitalWrite(ledPins[y], LOW); (ganz unten) + pinMode(ledPins[x], OUTPUT); + //for (int ll=0; ll!=10; ll++) for (int l=0; l!=0x7fff; l++) dummy=l; + for (int l=0; l!=0x80; l++) dummy=l; + pinMode(ledPins[x], INPUT); + } + } + pinMode(ledPins[y], INPUT); + digitalWrite(ledPins[y], LOW); + } +} diff --git a/Matrix_7x13/Matrix_7x13.pde b/Matrix_7x13/Matrix_7x13.pde new file mode 100644 index 0000000..377eda2 --- /dev/null +++ b/Matrix_7x13/Matrix_7x13.pde @@ -0,0 +1,125 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. + */ +#define ROW 3 +#define COL 0 +#define ROWCNT 7 +#define COLCNT 13 +#define CHARWIDTH 5 +#define FRAMELEN 10 + +#define DELAY 3 + +int frame[COLCNT][ROWCNT] = {0}; + +/*const int frame_A[ROWCNT][CHARWIDTH] = { + {0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 1, 0, 1, 0}, + {0, 1, 0, 1, 0}, + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, +};*/ + +/*const int frame_C[CHARWIDTH][ROWCNT] = { + {0, 0, 1, 1, 1}, + {0, 1, 1, 0, 0}, + {1, 1, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 1, 0, 0, 0}, + {0, 1, 1, 0, 0}, + {0, 0, 1, 1, 1}, +}; + +const int frame_H[ROWCNT][CHARWIDTH] = { + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, +}; + +const int frame_L[ROWCNT][CHARWIDTH] = { + {1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1}, +};*/ + +const int frame_MINUS[CHARWIDTH][ROWCNT] = { + {0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0}, +}; + +const int emptyCol[ROWCNT] = {0}; + +unsigned long int framenr = 0; +int rownr = 0; +void setup() { + // initialize the digital pin as an output. + // Pin 13 has an LED connected on most Arduino boards: + int i; + for (i = 0;i < ROWCNT; i++) + pinMode(ROW + i, OUTPUT); + for (i = 0;i < COLCNT; i++) + pinMode(COL + i, OUTPUT); +} + +void setCol(int c, const int data[ROWCNT]) { + int r; + + if (c > 0 && c <= COLCNT) { + for (r = 0; r < ROWCNT; r++) + frame[c][r] = data[r]; + } +} + +void setChar(int c, const int data[CHARWIDTH][ROWCNT]) { + int i; + for (i = 0; i < CHARWIDTH; i++) + setCol(c+i, data[i]); +} + +void clearFrame() { + int i = 0; + for (i = 0; i < COLCNT; i++) + setCol(i, emptyCol); +} + +void nextFrame() { + int c; + int f2 = (framenr/FRAMELEN) % (COLCNT+CHARWIDTH); + + clearFrame(); + setChar(COLCNT-f2, frame_MINUS); +} + +void loop() { + int i; + + rownr = ( rownr + 1 ) % ROWCNT; + + if (rownr == 0) { + framenr++; + nextFrame(); + } + + for (i = 0; i < COLCNT; i++) { + digitalWrite(COL + i, frame[rownr][i]); + } + digitalWrite(ROW + rownr, HIGH); + delay(DELAY); + digitalWrite(ROW + rownr, LOW); +} -- cgit v1.2.3