The traditional way to start programming in a new language is to get your computer to say, “Hello, World!”.


Open the software online Python Editor.
Connect the mico:bit to the computer with the USB cable.

Download the file in the computer.
Drag and drop the file in the MICROBIT device.

Program’s explanation
The first line:
# Add your Python code here. E.g.
… is a comment. The MicroPython language doesn’t care to it. A comment begins always by #
.
The second line:
from microbit import *
…tells MicroPython to get all the stuff it needs to work with the micro:bit. All this stuff is in a module called microbit
.
The third line:
while True:
… is a infinite loop. The loop works while True is true! The indent code is in the loop.
The fourth line:
display.scroll('Hello, World!')
…tells MicroPython to use the display to scroll the string of characters “Hello, World!”.
The fifth line:
display.show(Image.HEART)
… tells MicroPython to use the display to show the HEART image.
The sixth line:
sleep(2000)
… tells MicroPython must wait 2 000 milliseconds.
DIY: Do It Yourself
Scroll the message « Welcome to the STI2D class! » with a delay of 4 seconds between each message.