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

3pi+ 2040 Robot - Standard Edition (30:1 MP Motors), Assembled
3pi+ 2040 Robot - Turtle Edition (75:1 LP Motors), Assembled
3pi+ 2040 Robot - Hyper Edition (15:1 HPCB Motors), Assembled
3pi+ 2040 Robot Kit with 30:1 MP Motors (Standard Edition Kit)
3pi+ 2040 Robot Kit with 75:1 LP Motors (Turtle Edition Kit)
3pi+ 2040 Robot Kit with 15:1 HPCB Motors (Hyper Edition Kit)
3pi+ 2040 Control Board
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors