How to start PWM fan when pi 4 boots

From Geekworm Wiki
Jump to navigation Jump to search

How to start PWM fan when pi 4 boots)

But we hope that the script can be executed automatically when the Raspberry Pi board boots, we can use crontab system command to achieve it. please refer to the following

sudo crontab -e Choose "1" then press Enter

Add a line at the end of the file that reads like this:

@reboot python /home/pi/fan.py

Please note the path of this file.

Save and exit (CTRK + O and ENTER to save it). In nano editor, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted.