raspberry pi 關閉7寸觸控螢幕的方法

關閉:

sudo sh -c 'echo 1 > /sys/class/backlight/rpi_backlight/bl_power'

開啟:

sudo sh -c 'echo 0 > /sys/class/backlight/rpi_backlight/bl_power'

切換:

if [ "$(cat /sys/class/backlight/rpi_backlight/bl_power)" -eq "0" ]; then \
  sudo sh -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"; \
else \
  sudo sh -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"; fi