PINE64
Adjust brightness of LCD on Armbian Desktop with 1 click - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Pine A64 Hardware, Accessories and POT (https://forum.pine64.org/forumdisplay.php?fid=32)
+---- Forum: LCD and Touch Panel (https://forum.pine64.org/forumdisplay.php?fid=37)
+---- Thread: Adjust brightness of LCD on Armbian Desktop with 1 click (/showthread.php?tid=4438)



Adjust brightness of LCD on Armbian Desktop with 1 click - JulianM - 04-02-2017

Hello together!

I figured out how to adjust the bightness of the LCD with just 1 click on desktop with Armbian.
It's really not a big thing, but maybe some "newbies" may like this Smile

Thanks to pfeerick for his topic about LCD Support on Linux!



Step #1:
Create the script.
(Replace "YourUserName" with your username Tongue)
Code:
nano /home/YourUserName/brightness.sh
Code:
#!/bin/bash
bright=/sys/class/gpio/gpio362/value

if grep -q "0" $bright; then
  sudo echo 1 > $bright
else
  sudo echo 0 > $bright
fi
Save the file (F3) and close it (CTRL+X).

Code:
chmod +x /home/YourUserName/brightness.sh



Step #2:
Using GPIO to increase/decrase.
Execute these commands as ROOT user!
Code:
nano /home/YourUserName/gpio-brightness.sh
Code:
#!/bin/bash
echo 362 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio362/direction
Save the file (F3) and close it (CTRL+X).

Code:
chmod +x /home/YourUserName/gpio-brightness.sh
Code:
(crontab -l ; echo "@reboot /bin/bash /home/YourUserName/gpio-brightness.sh")| crontab -



Step #3:
Change sudoers settings
Execute these commands as ROOT user!
Code:
visudo

Add the following code to the end of the file:
Code:
YourUserName ALL=NOPASSWD: /home/YourUserName/brightness.sh
Save the file (F3 if nano) and close it (CTRL+X if nano).



Step #4:
Add an icon to the taskbar (XFCE).
• Right click on the taskbar.
• Add a new element.
• Add a new "Launcher".
• Close the window and right click on the new launcher => Properties.
• Click on the right side "Create new object"
• Enter a custom Name for your Icon.
• Enter the command: sudo /home/YourUserName/brightness.sh
• You may set a icon.
• Create.



Step #5:
Now reboot your Pine64 and you're done!


Now you're able to change the brightness of the LCD with just 1 click!
It's nothing big as I already said Shy


Best regards
Julian