M5Stack MicroPython Quick Start

This tutorial applies to M5PAPER

Driver Installation

Click the link below to download the driver that matches the operating system. There are currently two driver chip versions (CP210X/CH9102). Please download the corresponding driver compressed package according to the version you are using. After decompressing the compressed package, select the installation package corresponding to the number of operating systems to install. (If you are not sure of the USB chip used by your device, you can install both drivers at the same time. During the installation process of CH9102_VCP_SER_MacOS v1.7, an error may occur, but the installation is actually completed, just ignore it.)

Driver name Applicable driver chip Download link
CP210x_VCP_Windows CP2104 Download
CP210x_VCP_MacOS CP2104 Download
CP210x_VCP_Linux CP2104 Download
CH9102_VCP_SER_Windows CH9102 Download
CH9102_VCP_SER_MacOS v1.7 CH9102 Download

Burning tool.

Please click the button below to download the appropriate M5Burner firmware burning tool according to the operating system you are using. Open the application after decompression.

Software Link
M5Burner_Windows Download
M5Burner_MacOS Download
M5Burner_Linux Download

Pay attention:
MacOSAfter the user has completed the installation, please put the application into theApplication,As shown in the following figure。
LinuxFor users, please switch to the decompressed file path and run in the terminal../M5Burner, run the application。

Firmware burning

Double-click to open the Burner burning tool, select the corresponding device class in the left menu, select the firmware of the matching device, and click the download button to download.

Connect the M5 device to the computer through the Type-C data cable, Burner will automatically select the corresponding COM port, the baud rate can use the default configuration in M5Burner, click on Burn.

In the firmware burning stage, you need to fill in the WiFi information into the WiFi configuration box. The information will be burned and saved to the M5 device along with the firmware, and click on Start to start burning. Note: If the programming timeout occurs, try to reduce the baud rate to 115200.

When the burning log prompts Burn Successfully, it means that the firmware has been burned.

When burning for the first time or the firmware program runs abnormally, you can click Erase in the upper right corner to erase the flash memory. In the subsequent firmware update, there is no need to erase again, otherwise the saved Wi-Fi information will be deleted and refreshed API KEY.

VSCode IDE Development.

Preparatory work.

Download. VSCode IDE: Click here to download
Install the M5Stack plug-in: Search the plug-in market for M5Stack and install the plug-in, as shown below.

Connect to Device.

Click the Add M5Stack option in the lower left corner and select the corresponding device port to complete the connection.

Screen control

After completing the above steps, let's implement a simple screen display case program, open the M5Stack file tree, and type in the following program. Click Run in M5stack to make the screen red easily. If the device is reset, click the refresh button to reopen the file tree.

Sample code.

from m5stack import *
from m5ui import *
from uiflow import *
remoteInit()

setScreenColor(15)


slider_value = None



rectangle0 = M5Rect(220, 430, 100, 100, 0, 0)
circle0 = M5Circle(270, 690, 30, 0, 0)




def button_2_callback():
  global slider_value 
  rectangle0.setBgColor(15)
  lcd.show()

def button_1_callback():
  global slider_value 
  rectangle0.setBgColor(0)
  lcd.show()

def slider_2_callback(slider_value):
  print(slider_value)
  circle0.setSize(slider_value)
  lcd.show()

lcd.qrcode('https://flow.m5stack.com/remote?id=undefined', 170, 32, 200)
lcd.show()
On This Page