--Preparation of Raspberry Pi --The Raspberry Pi OS is installed on the microSD, and you can start the Raspberry Pi. --The Raspberry Pi code is written using an external keyboard, mouse, and display.
First, in the Raspberry Pi terminal, move to the directory containing the file you want to execute. I saved it on my desktop so I moved there
sudo chmod 755 filename.extension
In the case of I
Desktop
sudo chmod 755 test.py
Execution authority is now okay.
The file loaded at startup is located in /etc/rc.local. Execute the following command in the terminal.
sudo nano /etc/rc.local
On echo 0
, enter the command you want to execute at startup.
//Described here
echo 0
In my case it runs the Python file on my desktop
python3 /home/pi/Desktop/test.py
Save with this.
You can save it with ctr + o
, then with enter
, and with ctr + x
.
This will execute the specified file when you start Raspberry Pi instead of GUI operation.
The chmod that appears on the way is the authority. What to do with the permissions of that file ,. about it. This time I wrote the authority 755.
According to Reference Site
Regular directories, commands, CGI scripts, etc. Anyone can read and execute, but only write.
It is the authority.
Recommended Posts