Adjust PocketCHIP's screen brightness to suit its environment.
- Connect a light-dependent resistor (LDR) in series with a 10K resistor between +3V and Ground
- Connect the junction of the LDR and the resistor to the ADC pin
This script works thanks to the very useful chip-io and johnny-five. These are a bit bloaty for such a simple app as this, but meh.
I've tested this with node.js 6.6.0. It'll probably work on earlier versions with some changes.
I could automate more of this, but for now I won't.
cd /path/to/pocketchip-adaptive-brightness
npm install
chmod +x ./index.js
(This will take a while, because of slowness and some bloat.)
To try it out:
./index.js
If you want to run this as a background service, edit pocketchip-adaptive-brightness.service so that the ExecPath value points to the correct place, then:
sudo cp pocketchip-adaptive-brightness.service
sudo systemctl start pocketchip-adaptive-brightness start
If you want the service to start up automatically upon boot:
sudo systemctl enable pocketchip-adaptive-brightness
Follow the above instructions at your own risk.