How to PWM control backlight brightness on 7-inch B and 7-inch C
Note: This method is only valid for 7-inch B Rev3.2, 7-inch C Rev3.3 or above products.
Connect Raspberry Pi:
Execute the following commands on the Raspberry Pi 3B/3B+ to control the brightness of the backlight:
gpio -g pwm 18 1024 gpio -g mode 18 pwm gpio pwmc 1000 gpio -g pwm 18 X
(The value of X should be between 0 and 1024, 0 is the brightest and 1024 is the darkest)
In Raspberry Pi 4B, you need to update the wiringPi GPIO library first (the Raspberry Pi needs to be connected to the Internet):
cd /tmp wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i -B wiringpi-latest.deb
Execute the following commands to control the brightness of the backlight:
gpio -g pwm 18 1024 gpio -g mode 18 pwm gpio pwmc 1000 gpio -g pwm 18 X
(The value of X should be between 0 and 1024, 0 is the brightest and 1024 is the darkest)