I'm trying to use a potentiometer as a method to adjust the sensitivity for color-changing LED to be used as a party light.
The idea is that an LED will display a specific color if a defined threshold is met; however, I want to adjust that value relative to the setting on a potentiometer.
Therefore if music is quieter I can adjust the threshold down or vice versa
How I'm reading the potentiometer value currently
float SensitivityValue = analogRead(Sensitivity);
I am able to read the state of the potentiometer easily and I've been able to a value between 0.00 and 1. However, I want to try and get a value between 0.5 (Max potentiometer) and 1 (Min). Because I intend to divide my threshold value by the Sensitivity value in order to increase it.
Code snippet of how the threshold works.
else if (value > ( 520 / SensitivityValue) && value <= (525 / SensitivityValue))
Serial.println("Yellow"); // Value
RGBColor(255, 255, 0);
I would also appreciate any other suggestions on how to accomplish this.