Hello,
I am looking for some input or direction to links that could help me out. I have a wearable light project. I am using a Teensy 3.2 and Bluetooth to send commands from my Android phone. The lights I am using are WS2812B. I am currently using the Adafruit_Neopixel Arduino library but want to change to FastLED. I understand that FastLED is faster and more capable. I currently have four light patterns and want to add more. The interface I have from my phone to the Teensy was made using App Inventor. Basically I press a button on my phone that sends a signal stating which pattern to run. I am using code from Adafruit that works with multi-tasking. (reference https://learn.adafruit.com/multi-tasking-the-arduino-part-3/overview?view=all) This code is useful in that I can “interrupt” code mid run and have minimal lag.
So, the help I am looking for is how can I add multiple patterns / sketches in to one sketch and control it from my phone using FastLED and not have any lag from changing from one pattern to the next? I have searched for FastLED and multiple sketches in one but have not been successful yet. I want the multi-tasking abilities and not have to deal with the issues the multi-task article describes regarding interrupts and having to wait for the cycle to complete before the command is recognized and implemented.
Thanks
Generally WS2812 style LEDs don’t play nicely with interrupts.
APA102C style LEDs are less of a problem.
I’d actually suggest using @Jason_Coon ’s tree code on a WeMos D1 mini. The controller is cheap and powerful and supported by FastLED. And there’s a li-ion battery controller shield available.
The just set up the WiFi to log onto your phone’s hotspot and away you go. No android code required :))
Have you looked at or tried the DemoReel100 example? https://github.com/FastLED/FastLED/blob/master/examples/DemoReel100/DemoReel100.ino
It shows an easy way to include multiple patterns. It switches automatically at a regular interval, but this can be modified to change on a button press, wi-fi request, BLE, etc.
Thanks Jeremy, but my project already exists and I prefer not to change any hardware at this point. The Adafruit multi-task code works pretty well but as I mentioned I want to use FastLED.
Thanks again Jason. I have looked over the Demo Reel and I think there may be things I can work with there. I need to figure out how to get the code to see input. That is the reason why I posted my other post about commands used in FastLED. I am a beginner with coding but do have people to assist me at my local maker space when I come across bumps. My initial thought with the DemoReel is that I could change line 57 from timing to “see” input.