Hello! I’m completely new to electronics but I bought some WS2812B strips a while ago on a whim and discovered fastLED & the nice community behind it. You guys are so helpful over here!
Let me know if there’s anything I could do to optimize it because I’m still super new at this. One thing I got stuck on was that I couldn’t figure out how to trigger a non-static light pattern with the remote control. Every moving pattern I have (for example, a rain animation) gets stopped on one frame. I got them to “play" by spamming the button really fast. Is this because the controller can’t play an animation at the same time as it takes in IR data?
Hi. This looks great. I think your problem is the if() statement in line 36. All your code only gets executed when there is an infrared input. I hope it works. I never used the IR library.
exactly, it is the if statement
“if (irrecv.decode(&results))”.
Maddy, the irrecv.decode method return TRUE if you do something on your remote control. If nothing read, it returns FALSE - so nothing is done in your sketch.
Example:
void loop() {
if (irrecv.decode(&results)) {
// do here every thing you want
// to do to change the pattern
// like
if (results.value == 0xFD00FF) {
// …
}
}
//
// below commands will be executed every
// time.
//
FastLED.delay(1000 / 120);
EVERY_N_MILLISECONDS(20) {
gHue++;
}
FastLED.show();
} // void loop
That should work - hopefully
What you can do is, put FastLED.show() outside of the if statement and you need this statement only once per time not in every sub if-statement(s).
BTW: for better reading of source code, do some indentions like this:
if (results.value == 0xFD00FF) {
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.show();
}
That’s a big help, thank you!! I was getting frustrated with getting back static patterns so I just gave up on that bit. I’ve updated the code (https://gist.github.com/mock-turtle/be0fa63a1f409bdd034f) but my sister already left back for her place this morning and took her cloud, so I can’t test it out right now.
I wrote out some instructions for her, so hopefully she’ll be able to upload the fixed version herself to test it. I’ll let you guys know if it works!
I just bought a cheap pillow from Walmart and tore it apart to use the stuffing. On the inside, the circuit is housed in a clear plastic spinach container.