I have got this light box with 6 lights in it. The lights come on in response to music (loudness?). In the middle of the device, there are 3 variable resistor knobs; each knob controls the sensitivity of a pair of lights.
It is my understanding that these resistors set how high the mic input level needs to be before turning on the appropriate pair of lights.
The resistors ideally need to be adjusted for each music track, because one track might be louder than another.
In my opinion, this light box is just gagging to loose the variable resistors and have a microcontroller ‘brain’.
Could someone please advise the best way of going about this?
My first idea of how to implement this (without thinking about hardware considerations
) is as follows:
Assign each of the pairs of lights a port.
Poll mic level continuously
Have a variable to store the highest input level encountered so far (TempHighest Level).
Have another variable to store the last measured Highest input (i.e. HighestLevel).
Every x seconds, move the TempHighest variable into HighestLevel variable, and start measuring again, storing the new measurements in the TempHighest variable.
Don’t flash lights for x seconds when first turned on, just measure the highest level and store in TempHighest.
Assign each pair of lights a percentage of the HighestLevel variable, at which to turn on.
When mic level reaches each pairs specified percentage level, turn pair on.
I’m guessing I should use the comparator, but id like to know if the above is possible before I start coding.
Does anyone have any thoughts on the matter?
Many thanks