|
Posted at 2/10/2019 23:40:20
Only Author
2#
Last edited by abutkov In 2/10/2019 20:43 Editor
It was a kind of surgery to perform soldering, I've lost original 0402 so had to put 0805 with wire
And finally it does work:
- #!/bin/bash
- FAN_ON_TEMP="39000" # operating temperature range in milliC
- FAN_OFF_TEMP="35000" # OFF is less than ON for hysteresis
- if [ ! -d /sys/class/gpio/gpio33 ];
- then
- echo 33 > /sys/class/gpio/export;
- echo out > /sys/class/gpio/gpio33/direction;
- fi
- echo 1 > /sys/class/gpio/gpio33/value;
- while [ 1 ]; do
- read CPUTEMP < /sys/class/thermal/thermal_zone0/temp
- if [ "$CPUTEMP" -gt "$FAN_ON_TEMP" ]; then echo 1 > /sys/class/gpio/gpio33/value; fi
- if [ "$CPUTEMP" -lt "$FAN_OFF_TEMP" ]; then echo 0 > /sys/class/gpio/gpio33/value; fi
- sleep 30
- done
Copy the code You can even create a systemd service if you wish. |
|