M5Stack
or USB Serial
. Windows recommends installing the driver file directly through Device Manager (Custom Update) for proper functionality, as the executable installation method may not work correctly).
Click here to download the FTDI driver
System Preferences
-> Security & Privacy
-> General
-> Allow apps downloaded from
-> App Store and identified developers
.Users who need to specify the burning file can also use Kflash for firmware burning.
Click to download firmware file
Software Version | Download Link |
---|---|
Kflash_GUI_Windows | Download |
Kflash_GUI_MacOS | Download |
Kflash_GUI_Linux | Download |
Once connected successfully, you will automatically enter the MaixPy interactive interface. At this point, the device is running the default program. You can interrupt its operation by pressing the shortcut key "Ctrl+C" and enter the command line.
In the Read-Eval-Print Loop (REPL), we can easily input programs and immediately get running results. However, this is only suitable for verifying short programs. In actual projects, the large code volume necessitates editing the code into individual files.
In MaixPy, there is a built-in open-source editor called Micropython Editor(pye) , which allows us to conveniently modify program files.
Use os.listdir()
to view the files in the current directory,
Use pye("hello.py")
to create a file and enter editing mode (if a file with the same name exists, it will only enter editing mode). Shortcut key usage instructions can be found
here
After editing in the editor, press Ctrl+S
> Enter
to save, and press Ctrl+Q
to exit editing.
Note: This editor has certain requirements for the serial tool used. The BackSpace
key must be set to DEL
functionality; otherwise, pressing BackSpace
will call the same function as Ctrl+H
(i.e., character replacement).
Use os.chdir()
to switch the current directory to the directory of the file, for example os.chdir("/flash")
import
Then execute import hello
You will see the output hello maixpy
This method is simple and easy to use, but it should be noted that currently import
can only be used once. If import
is used again, the file will not be executed. If multiple executions are required, it is recommended to use the following method.
exec()
Use the exec()
function to execute
with open("hello.py") as f:
exec(f.read())
The system will create a boot.py
file in the /flash
or /sd
directory, and this script will be executed automatically at boot. Edit the contents of this script to achieve auto-startup.
MaixPy IDE enables convenient real-time editing, uploading, execution of script programs, as well as real-time monitoring of camera images, file transfer, and other functions. Using MaixPy IDE may result in some performance degradation due to data compression and transmission, but it is a very good development tool for developers with not very demanding performance requirements or in the debugging phase.
For Windows platforms, double-click the exe file to run the installation program.
For Linux, give executable permission via the command line, then execute the command
chmod +x maixpy-ide-linux-x86_64-0.2.2.run
./maixpy-ide-linux-x86_64-0.2.2.run
Run MaixPy IDE, click the toolbar, select the model of the development board. Tool
-> Select Board
-> M5StickV
(Tools->Select Development Board)
Click the connection button at the bottom left, and select the correct connection port, then click OK.
When the connection button changes from green to red, it means the connection is successful. You can edit code in the editing box at the top and click the run button at the bottom left to execute the code for verification.
The firmware has a built-in WS2812 RGB LED driver library. Below is a reference example. Note: Because UnitV's expansion ports do not have driving load capability, this program is only suitable for driving built-in RGB LEDs:
from modules import ws2812
from fpioa_manager import *
fm.register(8)
class_ws2812 = ws2812(8,100)
r=0
dir = True
while True:
if dir:
r += 5
else:
r -= 5
if r>=255:
r = 255
dir = False
elif r<0:
r = 0
dir = True
for i in range(100):
a = class_ws2812.set_led(i,(0,0,r))
a=class_ws2812.display()
In the library documentation, you can find more APIs to help you build various applications.