Funktioniert jetzt auch!
This commit is contained in:
parent
74a8eaeac6
commit
2ca8764788
|
@ -23,9 +23,9 @@ uint16_t currColor[2];
|
|||
|
||||
typedef struct {
|
||||
char text[17]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
char len = 0;
|
||||
byte len = 0;
|
||||
unsigned char speed;
|
||||
char pos = 0;
|
||||
signed char pos = 0;
|
||||
unsigned long millis = 0;
|
||||
} runtext;
|
||||
|
||||
|
@ -50,9 +50,20 @@ void setup()
|
|||
currColor[1] = colors[random(NUM_COLORS)];
|
||||
|
||||
setParams(&text[0], "/usr/space", 1000);
|
||||
setParams(&text[1], "Wir haben offen!", 1000);
|
||||
setParams(&text[1], "Wir haben offen!", 100);
|
||||
}
|
||||
|
||||
void move(runtext *textstruct, int row){
|
||||
if(millis()-(textstruct+row)->millis>=(textstruct+row)->speed){
|
||||
(textstruct+row)->millis=millis();
|
||||
changed=true;
|
||||
(textstruct+row)->pos--;
|
||||
if((textstruct+row)->pos < -(textstruct+row)->len*6){
|
||||
(textstruct+row)->pos = matrix.width();
|
||||
currColor[row]=colors[random(NUM_COLORS)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
|
@ -62,29 +73,19 @@ void loop()
|
|||
matrix.setCursor(text[0].pos, 0);
|
||||
matrix.setTextColor(currColor[0]);
|
||||
matrix.print(text[0].text);
|
||||
matrix.setCursor(text[1].pos, 0);
|
||||
|
||||
matrix.setCursor(text[1].pos, 8);
|
||||
matrix.setTextColor(currColor[1]);
|
||||
matrix.print(text[1].text);
|
||||
|
||||
portDISABLE_INTERRUPTS();
|
||||
delay(1);
|
||||
matrix.show();
|
||||
delay(1);
|
||||
portENABLE_INTERRUPTS();
|
||||
|
||||
changed=false;
|
||||
}
|
||||
|
||||
if(millis()-text[0].millis>=text[0].speed){
|
||||
text[0].millis=millis();
|
||||
changed=true;
|
||||
text[0].pos--;
|
||||
if(text[0].pos<-text[0].len*6){
|
||||
text[0].pos = matrix.width();
|
||||
currColor[0]=colors[random(NUM_COLORS)];
|
||||
}
|
||||
}
|
||||
if(millis()-text[1].millis>=text[1].speed){
|
||||
text[1].millis=millis();
|
||||
changed=true;
|
||||
text[1].pos--;
|
||||
if(text[1].pos<-text[1].len*6){
|
||||
text[1].pos = matrix.width();
|
||||
currColor[1]=colors[random(NUM_COLORS)];
|
||||
}
|
||||
}
|
||||
move(text,0);
|
||||
move(text,1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue