I am trying to control Leds with a button to change if one is on or off and a potentiometer to control the brightness of the Leds. I am using a Raspberry Pi Pico. Is there a way to do this.
1 Answer
Yes.
The Pico has general GPIO you can use to read a button press or release.
The Pico has an ADC so you can read the potentiometer voltage.
The Pico has PWM which you can use to vary the brightness of the LEDs.
-
1I am having trouble doing both of these at the same time. My button is able to turn on the LES, and separately, the potentiometer can adjust the brightness. However, it cannot do both. When setting up an LED for a button, it has to be led = machine.Pin(15, machine.Pin.OUT) However, when using a potentiometer for the same LED, it has to be: led = machine.PWM(machine.Pin(15)) I cannot have the same LED function with a button and a potentiometer. Nov 3, 2022 at 20:13