Earlier we came across the
pye("filename.py") command to open an editor that directly edits files in the file system.
But slowly we will find that this method is only suitable for changing a small amount of code. When the amount of code is huge or we need to highlight support, it does not apply. We need to write the code on the computer and upload it to the board. Inside the file system
There are currently several methods:
uPyLoader is an open source software that allows you to easily connect to MaixPy and upload, download, and execute files, monitor output, and more.
Download the executable: release
Select the serial port and click the
Connect button to connect the board
The first time you run the software, you need to initialize it. Click
File->Init transfer files to complete the initialization. This will create two files in the board,
On the left, select the file you want to upload and click
Transfer to upload it to the board's file system.
On the right is the file inside the board, click
List files to refresh the file list, select the file name, click
Execute to execute the script file.
View -> terminal above to open the terminal to view the runtime output or send a command
linux 终端一样， 使用 rshell 的
Just like Linux terminal do, use rshell to copy files to board, use
Install rshell first
sudo apt-get install python3-pip sudo pip3 install rshell rshell -p /dev/ttyUSB1 # 这里根据实际情况选择串口
Then copy file~
ls /flash cp ./test.py /flash/ #复制电脑当前目录的文件 test.py 到开发板 flash 根目录
More about rshell: rshell on github
ampy is an easy-to-use command line tool for uploading, downloading, and executing files, and open source
Note that this tool is running on the computer, not on the board.
ampy --help to view help information
ampy run file_in_PC.py command also allows you to run the script directly on the board without uploading the script to the board.
After copying to the TF card, execute
import filename in the terminal to run the script.