This microbit python tutorial talks you through how to write python code that simulates fire on your micro:bit. It burns down gradually until you shake it to stoke the fire back to life.

It’s written for beginners so you don’t need any experience writing python code. It covers:

Concepts you'll understand

Concepts you’ll understand

Concepts:

  • Loops: repeating code with while and for loops
  • Selection: only running certain parts of the code if a condition is met
  • Images: how images can be represented as data in memory before being displayed on a screen
  • Operators: how the multiplication operator (*) works with strings, numbers and images

 

 

Skills covered in this tutorial

Skills covered in this tutorial

Skills:

  • How to change each pixel of an image on the micro:bit screen
  • How to use the accelerometer to check if the micro:bit has been shaken
  • How to choose a random number
  • How to fade and shift an image on the micro:bit screen

The next page shows a simulation of the code we’ll create in this tutorial.