To Control the backlight of the Raspberry Pi 7-inch touchscreen display

Using command line

Turn Off

echo 1 | sudo tee /sys/class/backlight/rpi_backlight/bl_power

Turn On

echo 0 | sudo tee /sys/class/backlight/rpi_backlight/bl_power
Set Brightness

https://github.com/raspberrypi/linux/commit/e9c356a2c18787d356567f24e7879875d7337efc

From Windows IoT

Seems hit and miss at the moment. Some users report it can be done via the display PCB’s 5 pin connector I2C pins, other users report its buggy, can cause touch to stop working and also causes problem with other I2C devices on the same bus. Also there’s no official documentation. A better way it seems is via a GPU mailbox interface feature but as yet we’ve not come across a simple implementation.

https://www.raspberrypi.org/forums/viewtopic.php?t=152495

https://social.msdn.microsoft.com/Forums/en-US/d1b1a79f-e1ec-4879-abd7-82ea523b35e9/brightness-controls-in-iot-rp3-official-touch-screen-backlight?forum=WindowsIoT

To Control the backlight of HDMI displays

Using command line

Turn Off

 vcgencmd display_power 0

Turn On

vcgencmd display_power 1