Good Afternoon,
I am working on a project using the WSB2812B LED strip, with a ATmega644A using the MCUdude/MightyCore plug in (GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535). I am using Fastled 3.3.3 with Ardunio 1.8.13 on Windows 10 and is using code based off "ColourWavesWithPalettes" (ColorWavesWithPalettes - demo of using cpt-city palettes in FastLED code · GitHub).
This project as 2 button inputs (Solid & Palette colour) and 2 outputs (LED DI & Mosfet gate). With the sequence being the following:
- Power on and start running a set of colour palettes with fade (STANDARD_COLOUR_PALETTE). This could be anything from 5-15 colours, with transitioning colours from red to green to blue to purple to yellow... etc .
- If "Palette colour" button is pressed, then change state to run 1 colour palette with fade (SINGLE_COLOUR_PALETTE) on repeat. E.G just purple with fade.
- While in SINGLE_COLOUR_PALETTE state, if "Palette colour" button is pressed then change colour to another 1 colour palette e.g blue but still in the SINGLE_COLOUR_PALETTE state.
- If in either "STANDARD_COLOUR_PALETTE" or "SINGLE_COLOUR_PALETTE" state and "Solid" button is pressed, then change state to run 1 solid colour (SOLID_COLOUR) e.g just blue with no fade.
- While in "STANDARD_COLOUR_PALETTE" if "Solid" button is pressed, then change to another solid colour e.g Red with no fade.
- While in "STANDARD_COLOUR_PALETTE" if "Palette colour" button is pressed then change state to colour palettes with fade (STANDARD_COLOUR_PALETTE).
In summary the code is made up of 3 states with for loops and if statements. I have most of this sequence working but I am struggling alot with step 2 & 3, as their is only 1 colour pallet "Playlist" that I am trying to use as STANDARD_COLOUR_PALETTE but also trying to pull induvial colour pallets from (SINGLE_COLOUR_PALETT).
One solution I thought of was to generate multiple separate a colour playlists one with the 5-15 colours that would fade to one another and many more that would just have the single colour pallet. The only issue is that I don't know how to code that into the exiting "ColourWavesWithPalettes" I used as a base.
My code is attached here: State Machine With Colour Palettes · GitHub
Any help would be greatly appreciated.
Thanks,