Introduction to MicroPython - 1

Lesson 27/38 | Study Time: 20 Min
Introduction to MicroPython - 1

Lesson Overview


Start coding your Micro:bit with Python, one of the world's most popular programming languages. You tell computers like the Micro:bit what to do by giving them instructions. Sets of instructions for computers are called programs. Programs are written in code, a language that both you and the computer can understand. You can program your Micro:bit using the online MakeCode block or Python text editors.

The Online Python editor is designed with teachers and learners in mind. You can easily enlarge the text size for sharing on a large screen or whiteboard, download projects as Python text files or .HEX files ready to flash onto a micro:bit. Using a recent Chrome or Edge browser you can download your programs direct to your Micro:bit using webUSB, and interact directly with your Micro:bit using the serial interface feature.

 


Performance Expectations 

  1. You will start by making some words and a picture appear on the Micro:bit's display. Flash it to your Micro:bit by downloading a hex file and transferring it, or flash it using a USB, and see words and pictures appear on your micro:bit
  2. Use a ‘while True’ statement which is an infinite loop like the forever block in MakeCode
  3. Understand why indentations are important in python

 

Guiding Ideas

  1. MicroPython comes with lots of built-in pictures to show on the display. For example, to make the device appear happy you type:                                                                                                      
  2. You can use lots more built-in images with Python. Try HAPPY, DUCK or GHOST
  3. You can also make your own pictures with this example. Try different numbers from 0 to 9 to make each LED darker or brighter: