Adjust brightness of LCD on Armbian Desktop with 1 click
#1
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
My forum topics:
• Create a WiFi hotspot on Debian 8
• Turn your Pine64 into a music server with mpd
• Adjust brightness of LCD on Armbian Desktop with 1 click
• My cases for Pine64 (acryl, lego & wood)

• Pine 64 - DACH - Facebook page for german-speaking Pine64-fans.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  LCD screen brightness/contrast Learnincurve 10 15,495 02-17-2017, 12:45 PM
Last Post: psychedup
  Armbian display manager issues modsbyus 0 2,978 02-08-2017, 06:18 PM
Last Post: modsbyus

Forum Jump:


Users browsing this thread: 1 Guest(s)