I'm currently working on an assignment which has to turn on an RGB LED using a potentiometer and button. The problem I currently have is that the button is supposed to change the color I want the LED to display (presses one time: red (pin9), again green (pin10), again blue (pin11)). As I'm changing through the ports with the potentiometer, the potentiometer will read it with as analogWrite. For example, if I move the potentiometer all the way to the left and press the button the LED will display red and move it back all the way to 0 and press the button twice the LED will stay red (do nothing). If I press it one more time it will turn off. Another example, I turn on red again, then use green and turn off blue using the potentiometer and button giving me orange. How do I make it so to accomplish all of this while using both and combining colors?
THIS IS A HW QUESTION AND NOT ASKING FOR A WHOLE SOLUTION BUT RATHER WHERE TO START BECAUSE I ALREADY GOT STUCK AND WANT TO RESTART PER SE
Edit:I solved my doubt! Thanks for the help!