summaryrefslogtreecommitdiffstats
path: root/Matrix_5x6
diff options
context:
space:
mode:
authorNils Schneider <nils.schneider@gmail.com>2011-11-06 22:07:24 +0100
committerNils Schneider <nils.schneider@gmail.com>2011-11-06 22:07:24 +0100
commit2fc64cbc442588dfb0763833cf8785e3cf81d132 (patch)
tree9c120eb0ea565a2e7bbfdad7c72b66f415b1de2c /Matrix_5x6
parent6131f4d269ab49b56a80a1337678a77e040d5be0 (diff)
downloadledmatrix-2fc64cbc442588dfb0763833cf8785e3cf81d132.tar
ledmatrix-2fc64cbc442588dfb0763833cf8785e3cf81d132.zip
lauftext META MEUTE
Diffstat (limited to 'Matrix_5x6')
-rw-r--r--Matrix_5x6/Charlie/Charlie.pde47
-rw-r--r--Matrix_5x6/Charlie/font.h47
2 files changed, 94 insertions, 0 deletions
diff --git a/Matrix_5x6/Charlie/Charlie.pde b/Matrix_5x6/Charlie/Charlie.pde
index fa7f4a0..32b1e83 100644
--- a/Matrix_5x6/Charlie/Charlie.pde
+++ b/Matrix_5x6/Charlie/Charlie.pde
@@ -1,5 +1,7 @@
#include <Charlieplex.h>
+#include "font.h"
+
/* TODO:
* Laufschrift
* Ameise
@@ -156,8 +158,53 @@ void schnecke(int s) {
}
}
+void shift_scr_left() {
+ int x, y;
+
+ for (x=0; x<5; x++)
+ for (y=0; y<5; y++)
+ scr[x][y] = scr[x+1][y];
+
+}
+
+void lauftext(char *text) {
+ byte c;
+ byte *f;
+ int x, y;
+ x = 5;
+ int i;
+
+ while (c = *(text++)) {
+
+ i = 6;
+ while (i--) {
+ if (c > 0x40 && c < 0x5B) {
+ f = &(font_chars[c-0x41][0]);
+ } else if (c >= 0x30 && c < 0x3A) {
+ f = &(font_numbers[c-0x20][0]);
+ } else if (c == ' ')
+ f = &(font_space[0][0]);
+
+ for (y=0; y<5; y++) {
+ scr[x][4-y] = (*(f+y)>>(i+1)&1) * 20;
+ }
+
+ drawscr(5);
+
+ if (x > 4) {
+ shift_scr_left();
+ } else
+ x++;
+ }
+
+ }
+
+
+}
+
void loop() {
// zufall_fading_up();
// zufall_fading_down();
+ lauftext("META MEUTE");
schnecke(random(4));
}
diff --git a/Matrix_5x6/Charlie/font.h b/Matrix_5x6/Charlie/font.h
new file mode 100644
index 0000000..b01794e
--- /dev/null
+++ b/Matrix_5x6/Charlie/font.h
@@ -0,0 +1,47 @@
+/* font from b00lean http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234005825 */
+
+byte font_space[][5] = {
+ {0x00,0x00,0x00,0x00,0x00}
+};
+
+byte font_chars[][5] = {
+ {0x7c,0x44,0x44,0x7c,0x44}, // a
+ {0x7c,0x44,0x78,0x44,0x7c},
+ {0x7c,0x40,0x40,0x40,0x7c},
+ {0x78,0x44,0x44,0x44,0x78},
+ {0x7c,0x40,0x78,0x40,0x7c},
+ {0x7c,0x40,0x70,0x40,0x40},
+ {0x7c,0x40,0x4c,0x44,0x7c},
+ {0x44,0x44,0x7c,0x44,0x44},
+ {0x7c,0x10,0x10,0x10,0x7c},
+ {0x0c,0x04,0x04,0x44,0x7c},
+ {0x44,0x48,0x70,0x48,0x44},
+ {0x40,0x40,0x40,0x40,0x7c},
+ {0x44,0x6c,0x54,0x44,0x44},
+ {0x44,0x64,0x54,0x4c,0x44},
+ {0x38,0x44,0x44,0x44,0x38},
+ {0x78,0x44,0x78,0x40,0x40},
+ {0x7c,0x44,0x44,0x7c,0x10},
+ {0x78,0x44,0x78,0x44,0x44},
+ {0x7c,0x40,0x7c,0x04,0x7c},
+ {0x7c,0x10,0x10,0x10,0x10},
+ {0x44,0x44,0x44,0x44,0x7c},
+ {0x44,0x44,0x28,0x28,0x10},
+ {0x44,0x44,0x54,0x54,0x28},
+ {0x44,0x28,0x10,0x28,0x44},
+ {0x44,0x44,0x28,0x10,0x10},
+ {0x7c,0x08,0x10,0x20,0x7c} // z
+};
+
+byte font_numbers[][5] = {
+ {0x7c,0x4c,0x54,0x64,0x7c}, // 0
+ {0x10,0x30,0x10,0x10,0x38}, // 1
+ {0x78,0x04,0x38,0x40,0x7c},
+ {0x7c,0x04,0x38,0x04,0x7c},
+ {0x40,0x40,0x50,0x7c,0x10},
+ {0x7c,0x40,0x78,0x04,0x78},
+ {0x7c,0x40,0x7c,0x44,0x7c},
+ {0x7c,0x04,0x08,0x10,0x10},
+ {0x7c,0x44,0x7c,0x44,0x7c},
+ {0x7c,0x44,0x7c,0x04,0x7c} // 9
+};