Support » Pololu 3pi+ 2040 User’s Guide » 5. Programming the 3pi+ with MicroPython »
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.