I have a simple script that adjusts the monitor's brightness that is set to run on startup.


gpio -g 18 1024
gpio -g mode pwm
gpio pwmc 1000
gpio -g 18 800

I am calling this script from /etc/rc.local.

It seems to work and after booting up, it adjusts the brightness before getting to login, but after I log in the screen goes dark, i.e., it looks like GPIO pin 18 is reset to 0. To fix this, I have to bring up a terminal and manually run the script to readjust the brightness.

An easy enough way to deal with this appears to be simply manually running the script again after logging in or maybe calling it from $HOME/.profile, but I would prefer a more permanent solution that makes the adjustment system-wide.


Adding the script to $HOME/.profile did not do the trick. It looks like some other script is called after that turns the screen dark again (possibly resetting GPIO 18 to 0).

  • 1
    You are going to have to give us more info, please edit your question and include the following: the code you are using, a short explanation of why you need this and finally your exact question - it appears you want to know how to do this but never actually ask. Jan 4 '19 at 13:26
  • 1
    If something else is manipulating GPIO 18 it is because you have requested the change. We can't magically guess what changes you have made to do this. However I will point out that audio may also affect GPIO 18.
    – joan
    Jan 4 '19 at 16:51
  • Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. Following the recommendation of the developers from systemd you should avoid using it. In particular it doesn't respect dependencies of starting services. This seems to be the case here.
    – Ingo
    Jan 4 '19 at 23:39
  • @joan: As far as I know, nothing else should be manipulating that pin. Nothing else is installed and I haven't really messed with GPIO until now.
    – user942937
    Jan 9 '19 at 2:36
  • @Ingo: is /etc/profile a better place to start the program?
    – user942937
    Jan 9 '19 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.