Permalink
Browse files

Added digits and an example for calling them

Now I can call digits out of thin air!
  • Loading branch information...
1 parent 5235679 commit 580a87de49dc7da8dc7800cd96cd85fee0276354 @pfriedel committed Apr 14, 2012
Showing with 83 additions and 0 deletions.
  1. +83 −0 ArdyCharlieLife.ino
View
@@ -52,6 +52,74 @@ char led_grid_next[20] = {
000 , 000 , 000 , 000 , 000
};
+char digits[12][20] = {
+ {
+ 000,100,100,100,000, // 0
+ 100,000,000,000,100,
+ 100,000,000,000,100,
+ 000,100,100,100,000
+ },
+ {
+ 100,000,000,000,100, // 1
+ 100,100,100,100,100,
+ 100,000,000,000,000,
+ 000,000,000,000,000
+ },
+ {
+ 100,100,000,000,100, // 2
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 100,000,000,100,000
+ },
+ {
+ 100,000,000,000,100, // 3
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 000,100,000,100,000
+ },
+ {
+ 000,100,100,100,100, // 4
+ 000,100,000,000,000,
+ 100,100,100,100,100,
+ 000,100,000,000,000
+ },
+ {
+ 100,000,100,100,100, // 5
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 000,100,000,000,100,
+ },
+ {
+ 000,100,100,100,000, // 6
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 000,100,000,000,000
+ },
+ {
+ 000,000,000,000,100, // 7
+ 100,100,000,000,100,
+ 000,000,100,000,100,
+ 000,000,000,100,100
+ },
+ {
+ 000,100,000,100,000, // 8
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 000,100,000,100,000
+ },
+ {
+ 000,000,000,100,000, // 9
+ 100,000,100,000,100,
+ 100,000,100,000,100,
+ 000,100,100,100,000
+ },
+ {
+ 000,000,000,000,000, // :
+ 000,100,000,100,000,
+ 000,000,000,000,000,
+ 000,000,000,000,000
+ }
+};
void setup() {
randomSeed(analogRead(0));
// Just a few simple LED testing sweeps...
@@ -61,8 +129,23 @@ void setup() {
negative_v_test();
positive_h_line_test();
negative_h_line_test();
+ num_test();
+}
+
+
+void num_test() {
+ for(int y = 0; y<=12; y++) {
+ for(int x = 0; x<20; x++) {
+ led_grid_next[x] = digits[y][x];
+ }
+ for(int f = 0; f<=1000; f++) { fade_to_next_frame(); }
+ for(int x = 0; x<20; x++) {
+ led_grid_next[x] = 0;
+ }
+ }
}
+
void loop() {
char led;

0 comments on commit 580a87d

Please sign in to comment.