Matrix Rain Code
Globale Variablen:
int pos[8] = {0,0,0,0,0,0,0,0};
int lng[8] = {1,1,1,1,1,1,1,1};
Pattern code:
case 4:
{
CHSV c_bg(113,100,0);
CHSV c_t(113,100,200);
CHSV c_p(113,100,230);
for(uint8_t x=0; x<8; x++) {
int h=pos[x];
int r=lng[x];
if(h<0) r = r+h;
for(uint8_t y=0; y<8; y++) {
if(h == y) {
hsvbuf1[x*8+y] = c_p;
} else
if(h < y) {
if(r<y) {
hsvbuf1[x*8+y] = c_bg;
} else {
hsvbuf1[x*8+y] = c_t;
}
} else {
hsvbuf1[x*8+y] = c_bg;
}
}
if(lng[x] > -pos[x]) {
pos[x]--;
} else {
pos[x] = random(8, 30);
lng[x] = random(6,12);
}
}
showHSVg(hsvbuf1);
lng[0] = random(6,12);
int d = map(para[1], 0,1023, 100,500);
delay(d);
}