summaryrefslogtreecommitdiffstats
path: root/Matrix_5x6/Charlie/Charlie.pde
diff options
context:
space:
mode:
Diffstat (limited to 'Matrix_5x6/Charlie/Charlie.pde')
-rw-r--r--Matrix_5x6/Charlie/Charlie.pde84
1 files changed, 75 insertions, 9 deletions
diff --git a/Matrix_5x6/Charlie/Charlie.pde b/Matrix_5x6/Charlie/Charlie.pde
index a0d2b73..ee7f5dd 100644
--- a/Matrix_5x6/Charlie/Charlie.pde
+++ b/Matrix_5x6/Charlie/Charlie.pde
@@ -11,19 +11,85 @@ charliePin ledi[] = { {0, 1} , {1, 0} , {2, 0} , {3, 0} , {4, 0} , {5, 0},
{0, 5} , {1, 5} , {2, 5} , {3, 5} , {4, 5} , {5, 4},
};
+int scr[6][5];
+
+void clrscr() {
+ int x, y;
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++)
+ scr[x][y] = 0;
+}
+
+void drawscr(int c) {
+ int x, y;
+ int s;
+ while (c--) {
+ s = 20;
+ while(s--)
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++) {
+ charlieplex.charlieWrite(ledi[x+y*6], scr[x][y]>s?HIGH:LOW);
+ charlieplex.clear();
+ }
+
+ }
+}
+
+void fadescr_down() {
+ int x, y;
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++)
+ if (scr[x][y])
+ scr[x][y] -= 1;
+}
+
+void fadescr_up() {
+ int x, y;
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++)
+ if (scr[x][y] < 30)
+ scr[x][y] += 1;
+}
+
+
int an = 2;
int aus = 10;
void setup(){ /*nothing*/ }
-void loop(){
- int i;
- for (i=0; i<30; i++){
- charlieplex.charlieWrite(ledi[i],HIGH);
- delay(an);
- charlieplex.clear();
- delay(aus);
- }
-
+void zufall_fading() {
+ clrscr();
+ int x, y;
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++)
+ scr[x][y] = random(30) + 2;
+
+ int i=30;
+
+ while (i--) {
+ drawscr(2);
+ fadescr_down();
+ }
+
+}
+
+void zufall_fading2() {
+ clrscr();
+ int x, y;
+ for (x=0; x<6; x++)
+ for (y=0; y<5; y++)
+ scr[x][y] = - random(30) - 2;
+
+ int i=50;
+
+ while (i--) {
+ drawscr(2);
+ fadescr_up();
+ }
+
+
+}
+void loop() {
+ zufall_fading2();
}