Skip to main content

Week4 - Micropython

Micropython

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.

Download Micropython Firmware

I choose the firmware from here.

Upload Micropython Firmware

I refer to my classmate - Hongtai's assignemnt, I choose a online tool for flashing the firmware to XIAO board.

  • Go to this link
  • choose <ESP32 COM PORT> from the dropdown menu.

  • Select the Firmware we just downloaded.

  • Click Program button
  • Waiting for the process
  • Done!

Connect to Micropython REPL

Open the serial monitor to observe the output. I use mobaXterm to connect to serial monitor.

  • Go to Session
  • Choose Serial
  • Choose the COM of the board and set the baud rate as 115200

Then, restart the board, you can see the command windows which can be inputed the command.

Write program

We send hello fab academy to serial monitor.

import machine
import time
while True:
print("hello, fab academy!")
time.sleep(1)

The program can be stopped by using Ctrl+C.