TL:DR (Key parts bolded)
So quick bit of background, I am working on a project; RGBLED integrated Miniatures and models, I have found that while I do have the resources and skill-sets to learn to code (C&I engineer), I just don't have the experience or time to dedicate to this while managing the other parts of the project. As such, I have started to use Fiverr, i have never used it before and I would like help making sure my project scope is well defined and clear with what I want achieved.
I am looking for advice and criticism across the whole project, so please feel free to jump in and add your 2 cents wherever! But my main focus from this topic is the Code specification/scope.
[u]The Project:[/u] (Project Example Video)
The project is to create bases for wargaming miniatures that can be 3D printed in a clear material, that then has a small circuit placed underneath, then depending on how thick you paint the base alters which part of the base glows.
The idea is to be able to create a 'lava themed' or other 'themed' bases that have a dynamic lighting effect.
[u]The Circuitry:[/u] So I am relatively happy with the circuit, this can/will change based upon how the code ends up operating, I can get this part sorted, but I need assistance getting the code right.
- Circular PCB - Dimensions = roughly 30mm circumference, height as thin as possible (most likely 10-15mm assuming CR2032 holder, PCB, SMT LEDs)
- 3x RGB LEDs
- Arduino program - ATTiny or ATMega microcontroller
- Button control for LED Pattern/colour/brightness
This similar product below highlights the rough size of the PCB I would aim to manufacture.
[u]The Code:[/u] So based upon the circuitry specifications above I am assuming that the code would look something like;
- A collection of patterns - maybe in case statements
- 1 button that cycles through the patterns when pressed
- 1 button that cycles through brightness
- 1 or more buttons that alter the colours in the pattern - this bit here is where I think it might be complicated? what if some patterns have multiple colours? like a fade transition?
My Questions: So the part i could do with help is understanding exactly how this could/best way to have this function is? I would assume the gold standard would be to use interrupts? So lets say you want to change the pattern, you push the button and an interrupt is called, the pattern variable increments and the code returns to where it was (previous pattern), once that PatternFunction is completed, the code would cycle back round, check the case statement and move to the new Patternfunction.
Colour choice seems to be the most complicated part? So pattern wise I intend to utilise patterns like the ones found here; (Pattern example code) this is a great resource and has been massively helpful. I would obviously only be using a selection of these effect styles as I only have 3 RGB LEDs and the chasing effects are probably a little pointless for my project.
From this it seems that most patterns are either a single colour, or two colours (fade between etc), thus in my mind the best way would be to have 2 variables; colour1 and colour2. These could then simply be a button that cycles you through the colour spectrum for one. for single colour patterns, colour2 does nothing.
I could, make those analog inputs with a variable pot and thus allow the user to adjust the colour that way?
Would the largest issue be viewing the colour as you change the variable? as if i use an interrupt the colour being displayed by the RGB LED will be static (whatever was last sent), so how do I get around that? Do i include an update of the LED colour within the interrupt?
Anywho this is getting a little long for the first post, so I will leave it there, please comment/critique, id love to get some feedback as how best to proceed here.