Skip to content

Instantly share code, notes, and snippets.

@msraynsford
Created March 21, 2018 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msraynsford/d52f6dafbb0466da3538311d8728953c to your computer and use it in GitHub Desktop.
Save msraynsford/d52f6dafbb0466da3538311d8728953c to your computer and use it in GitHub Desktop.
EVERY_N_MILLISECONDS(PAUSE) {
uint8_t color;
if((pos % 2) && (pos <= (msglen * 2))) {
char letter = msg[pos/2];
char mapped = mapChar(letter);
// Serial.printf("pos: %d, char: %c, num: %d\n", pos, letter, mapped);
if(mapped > 0) {
ledNo = MAP[mapped];
color = (ledNo % 4);
switch(color) {
case 0: leds[ledNo] *= 10; break;
case 1: leds[ledNo] *= 10; break;
case 2: leds[ledNo] *= 10; break;
case 3: leds[ledNo] *= 10; break;
}
}
}
else {
for(int i=0; i<NUMLEDS; i += 1) {
color = (i % 4);
switch(color) {
case 0: leds[i] = CRGB(0, 0, BRIGHT); break;
case 1: leds[i] = CRGB(0, BRIGHT, 0); break;
case 2: leds[i] = CRGB(BRIGHT, 0, 0); break;
case 3: leds[i] = CRGB(BRIGHT, BRIGHT, 0); break;
}
}
}
FastLED.show();
// Create a gap at the end of the message
pos += 1;
if(pos == (msglen * 2) + 4) {
pos = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment