5.2. Editing Python programs

With MicroPython installed on the robot, you can edit files directly on the board in any text editor. To get started, open blink.py on the MicroPython drive:

The blink.py demo program in a text editor.

This program turns the LED on for 100 ms and off for 600 ms, repeating forever. You can run this program from the menu of demo programs as described in Section 4. Make a small change to it, such as replacing the 600 with 100, save the file, and select blink.py from the menu again (you might need to reset the robot to get there.) It will run your updated program with the new blinking pattern.

Now, you can look around at the other files on the board, modify them, make new files, and run any of them from the menu. All of the original demo programs and other files are also available in our GitHub repository.

Note: when editing files directly on the board, keep in mind that it is easy to lose them in various ways:

  • Resetting or disconnecting the board while saving a file
  • Editing files from within a MicroPython program and from your computer at the same time
  • Loading a new firmware file that erases all data
  • Software bugs or hardware failure

To avoid losing work, we recommend saving backup copies periodically on your computer.

Related Products

Zumo 2040 Robot Kit (No Motors)
Zumo 2040 Robot (Assembled with 50:1 HP Motors)
Zumo 2040 Robot (Assembled with 75:1 HP Motors)
Zumo 2040 Robot (Assembled with 100:1 HP Motors)
Zumo 2040 Main Board
Zumo 2040 Front Sensor Array
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors