Lets assume you are using some model of Raspberry PI microcomputer, running some recent version of The Raspberry Pi Operating System - RasPiOS.I want to code five single color leds to to be dimmed when the corresponding mechanical switches arent being pressed. I then want them to be fully bright when I am pressing or holding down the corresponding mechanical switches. How would I code this in thonny?
And since you mention the Thonny IDE lets assume you are content with a solution that uses the Python programming language.
The PWMLED feature of the gpiozero library seems a possible way to code your solution.
https://gpiozero.readthedocs.io/en/stab ... brightness
You could combine that with the description of a Button. https://gpiozero.readthedocs.io/en/stab ... rolled-led
If you have a Raspberry Pi Pico microcontroller instead, you can find similar solutions for MicroPython in the picozero library. https://picozero.readthedocs.io/en/latest/
Statistics: Posted by B.Goode — Fri May 10, 2024 3:47 pm