Compare commits
No commits in common. "main" and "master" have entirely different histories.
|
@ -21,69 +21,35 @@ const PROGMEM uint16_t colors[NUM_COLORS] = {
|
||||||
};
|
};
|
||||||
uint16_t currColor[2];
|
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};
|
|
||||||
byte len = 0;
|
|
||||||
unsigned char speed;
|
|
||||||
signed char pos = 0;
|
|
||||||
unsigned long millis = 0;
|
|
||||||
} runtext;
|
|
||||||
|
|
||||||
runtext text[2];
|
|
||||||
|
|
||||||
void setParams(runtext *textstruct, char* text, unsigned char speed){
|
|
||||||
strncpy(textstruct->text, text, 16);
|
|
||||||
textstruct->len=min((int)strlen(text),16);
|
|
||||||
textstruct->speed=speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool changed=true;
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
matrix.begin();
|
matrix.begin();
|
||||||
matrix.setTextSize(1);
|
matrix.setTextSize(1);
|
||||||
|
Serial.begin(9600);
|
||||||
matrix.setTextWrap(false);
|
matrix.setTextWrap(false);
|
||||||
|
Serial.println("Setup Done");
|
||||||
currColor[0] = colors[random(NUM_COLORS)];
|
currColor[0] = colors[random(NUM_COLORS)];
|
||||||
currColor[1] = colors[random(NUM_COLORS)];
|
currColor[1] = colors[random(NUM_COLORS)];
|
||||||
|
|
||||||
setParams(&text[0], "/usr/space", 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()
|
void loop()
|
||||||
{
|
{
|
||||||
if(changed){
|
|
||||||
matrix.fillScreen(matrix.Color(0, 0, 0));
|
matrix.fillScreen(matrix.Color(0, 0, 0));
|
||||||
matrix.setCursor(text[0].pos, 0);
|
matrix.setCursor(i, 0);
|
||||||
matrix.setTextColor(currColor[0]);
|
matrix.setTextColor(currColor[0]);
|
||||||
matrix.print(text[0].text);
|
matrix.print("/usr/space @36C3");
|
||||||
|
|
||||||
matrix.setCursor(text[1].pos, 8);
|
|
||||||
matrix.setTextColor(currColor[1]);
|
matrix.setTextColor(currColor[1]);
|
||||||
matrix.print(text[1].text);
|
matrix.setCursor(i*3, 8);
|
||||||
|
matrix.print("Sticker Exchange Sticker Exchange");
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
delay(5);
|
delay(1);
|
||||||
matrix.show();
|
matrix.show();
|
||||||
delay(5);
|
|
||||||
portENABLE_INTERRUPTS();
|
portENABLE_INTERRUPTS();
|
||||||
|
if(--i < -16*6) {
|
||||||
changed=false;
|
i = matrix.width();
|
||||||
}
|
currColor[0] = colors[random(NUM_COLORS)];
|
||||||
move(text,0);
|
currColor[1] = colors[random(NUM_COLORS)];
|
||||||
move(text,1);
|
}
|
||||||
|
delay(249);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue