TigerJython4Kids | robotics |
YOU LEARN HERE... |
how to develop a program with Python and run it on the micro:bit. |
PROGRAM DEVELOPMENT |
Start TigerJython and edit the program in the editor window. Attach the micro:bit to the USB port and click the download button. A terminal (console) window opens and the program is run under the MicroPython (Python 3) interpreter which is part of the firmware. A running program can be stopped by typing Ctrl+C and restarted by typing Ctrl+D. The terminal window is automatically closed and reopened when the next program is download. |
CONNECTION VIA USB |
|
INSTALL FIRMWARE |
Download TigerJython and install it. Under Settings|Libraries choose the option micro:bit/Calliope. This setting remains saved and is also required for downloading/executing programs. In the Tools menu, select Flash target .
|
EXAMPLE |
To make your first steps, edit and run a program that writes some short scrolling text to the LED display. In the editor, type in the program below, or click Copy to clipboard and paste it with Ctrl + V into the editor window.
Next to the TigerJython a terminal (console) window appears. Print output and error messages are shown here. The program code is easy to understand: The first line of the program imports the microbit module and provides the objects and functions from this library, for example the object display with which you access the LEDs. With the command display.scroll ("HELLO PYTHON!") you can display short messages as scrolling text. Note that the text must be in single or double quotes! |
SIMULATION MODE |
|
MEMO |
Programs for the micro:bit are written using the TigerJython program editor. To download and run the program on the micro:bit, click the black button Download/Run. Program execution in simulation mode is started by clicking the green arrow button.
The last downloaded program is stored on the micro:bit and program execution starts automatically the next time a power supply is connected (or the reset button is clicked). If the program blocks the micro:bit entirely due to fatal error, you have to flash the micro:bit again. |
USING THE WEBTIGERPYTHON |
Most examples and exercises can also be executed in the browser with our web-based editor https://webtigerpython.ethz.ch . You can find a tutorial on micro:bit programming with WebTigerPython at |
EXERCISES |
|
REMARKS |
After the program finishes, the command-line prompt of the Python interpreter >>> is shown and you can type and execute Python commands interactively. With the key combination Ctrl+D a downloaded program is run again.
To run a program multiple times, you can click the reset button, which is located next to the USB port, instead of interrupting the power supply. |
If you are having trouble with the USB port, try another USB cable. Some USB cables, especially those supplied with PowerBanks, can only be used for charging and not for data transfer.
The firmware can be considered as a small operating system, which is also responsible for communication with the development system (The micro:bit appears on the PC as an external storage device and can exchange data as a serial device (COM port)). In addition, the firmware contains the MicroPython interpreter and the API for controlling the hardware.
The firmware is written in C++ and is available in public domain. We have slightly modified it so that error messages are no longer displayed on the LED display, which impedes the development process considerably.