diff options
author | Alexander Kauerz <kauerz@informatik.uni-luebeck.de> | 2011-11-04 00:23:50 +0100 |
---|---|---|
committer | Alexander Kauerz <kauerz@informatik.uni-luebeck.de> | 2011-11-04 00:23:50 +0100 |
commit | 184d9fb656b75534b5a4173f437db30d36e21b67 (patch) | |
tree | 0e9b01e9a11b9946f6602b73677b38b12d16fa30 /Matrix_7x13 | |
parent | 38759c6174617657ece84a6061cad36521ea5d0a (diff) | |
download | ledmatrix-184d9fb656b75534b5a4173f437db30d36e21b67.tar ledmatrix-184d9fb656b75534b5a4173f437db30d36e21b67.zip |
Quelltestdateien wurden mundfein gemacht.
Diffstat (limited to 'Matrix_7x13')
-rw-r--r-- | Matrix_7x13/Matrix_7x13.pde | 125 |
1 files changed, 125 insertions, 0 deletions
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); +} |