microPython IDEs for SBC¶
if you want to write your own software…
An IDE (Integrated Development Environment) is a software application that facilitates the programming task.
The SBC is compatible with any IDE that supports microPython.
In this section we want to introduce some of the IDEs that our engineers use on a daily basis to program the SBC:
Thonny –> if you don’t know where to start, for simplicity and ease of use, we suggest this one
Not much to say here :)
This is the simplest way to edit your code. You can use your preferred Notepad application, although Notepad++ is a nice one since it highlight Python syntaxis.
We use this editor to make quick changes to existing code that does not need much testing.
Thonny is a Python and microPython IDE.
We like it because it is free, multiplatform, light and easy to use.
In this quick tutorial we will only cover the basics, you can find more information on their website.
Connect your SBC to your PC via USB
Go to Tools > Options > Interpreter
Press the STOP button
If everything went ok, you should see a similar message in the shell which indicates that you connected successfully to the SBC microPython terminal.
6. You can now write your application in the main window and click the Play button to run it.
You will see your application output in the shell (window at the bottom).
Notice that you can also write commands directly in the shell.
We will make a quick tutorial explaining how to connect to your SBC via Putty.
Choose Connection type: Serial, desired COMx port and Speed as 115200, click Open.
If you don’t know your SBC COM port, you can use Windows device manager.
If the connection is succesfull, SBC will show a welcome message and the microPython prompt “>>>”
Write your code
REPL means “Read Eval Print Loop” and it is a native feature of python and micropython.
Here the user can develop scripts line by line, define functions or examine variables.
Just write a line of code and hit enter to execute it.
For more complex scripts, micropython supports paste mode. This mode allows paste longer scritps to the REPL.
To enter paste mode, press CRTL+D in a BLANK LINE. Micropython should change promt to “===”.
Now you can paste your scritps. Remember that Putty uses mouse right click as paste command.
Press CTRL-E to exit from the paste mode and execute your script.
Before start with jupyter notebooks, you can read the basic guide here: Notebook Basics.
The first step is to add a new notebook, for that you need to press new notebook button and select Micropython-USB kernel.
Cells are small scripts that can be executed in micropython. Press “+” button to add new cells
To tun cells, select cell and press “RUN” button
Before executing any sript in micropython, the user should connect to the SBC. To do so, run a cell with %serialconnect command.
Click the notebook title to rename it
When your script is done, you can save it as a Jupyter notebook (.pynb) or download it as an .html file