Tutorial
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Assembly and Precautions
- 5 Controlling Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 How to Control DC Motor
- 12 Ultrasonic Module
- 13 Line Tracking
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Automatic Obstacle Avoidance
- 17 Why OpenCV Uses Multi-threading to Process Vide
- 18 OpenCV Learn to Use OpenCV
- 19 Using OpenCV to Realize Color Recognition and T
- 20 Machine Line Tracking Based on OpenCV
- 21 Create A WiFi Hotspot on The Raspberry Pi
- 22 Install GUI Dependent Item under Window
- 23 How to Use GUI
- 24 Control The WS2812 LED via GUI
- 25 Real-time Video Transmission Based on OpenCV
- 26 Use OpenCV to Process Video Frames on The PC
- 27 Enable UART
- 28 Control Your AWR with An Android Device
- Conclusion
57
7 Set The Program to Start Automatically
7.1 Set The Specified Program to Run Automatically at Boot
●This section only introduces the auto-run method used by our products. If you need more information
about the Raspberry Pi auto-run program, you can refer to this document from itechfythe document Auto-Run.
● If you have used the operation steps of 3.5 or 3.6, then the script program has been configured to
automatically run the program at startup. In this chapter, we explain how to set a program to start automatically
at startup from scratch.
●First we use the following code to create a new startup.sh:
sudo touch //home/pi/startup.sh
●Edit startup.sh
sudo nano startup.sh
●Write the following content in startup.sh, where python3 is followed by the program you want to run
automatically. Note that you must use an absolute path here. Let's take webServer.py as an example.
#!/bin/sh
sudo python3 [RobotName]/server/webServer.py
●After Ctrl + X To exit editing. Press Y Save. Enter Confirm and exit editing.
●Give startup.sh permissions, where *** is the Linux permission code, we do not recommend the use of
permissions such as 777, but for novices 777 can avoid many account and permissions problems, of course,
you can also set it to 700 , So that only the owner can read, write and execute startup.sh, you can learn more
about Linux permissions through this article from maketecheasier the article link Understanding File
Permissions.
sudo chmod 777 //home/pi/startup.sh
●Edit rc.local to configure the script to run automatically
sudo nano /etc/rc.local
●Add the following content under fi in the original document, save and exit:
//home/pi/startup.sh start
● Of course, you can also replace the above script file path with other scripts you want to run
automatically.
7.2 Change The Program That Starts Automatically
●After step 7.1, you can already set the program to run automatically at boot. If you want to change the
program to run automatically at boot, just edit startup.sh:
sudo nano //home/pi/startup.sh