Chapter 5 • BBC micro:bit Projects
Chapter 5 • BBC micro:bit Projects In this chapter we will be developing simple programs to run on the BBC micro:bit computer. All the programs are developed using the Microsoft Touch Develop and the microPython programming languages. The steps required to create a program, load it into the memory of the BBC micro:bit computer and then run it are explained in this section. The following sub-headings will be given for each project: Description: Brief description of the project Aim: The aim of the project, explaining what is to be learned from the project Programming Steps: The programming steps are given with full Touch Develop and microPython program listings and description of the program. Try for Yourself: Ideas related to the project to try for yourself If the project uses an external component then the block diagram and the circuit diagram of the project will also be given. It is recommended that you run your program on the simulator if possible before uploading it to the actual BBC micro:bit computer. Project 1 - Turn on BBC micro:bit LEDs
Description: In this project the 5 LEDs on the first row of the LED matrix will turn ON Aim: The aim of this project is to show how to use the show leds statement and how to compile and run a Touch Develop program. Touch Develop Programming • Start a new project as described earlier. You should see a script name and a function block. Change the name of the script to LEDs by clicking on the existing name • Click add code here inside the function main() • You should see the list of valid Touch Develop commands at the bottom of the screen • Click basic and then show leds. You should see the LED matrix displayed. Click the LEDs to be turned ON as shown in Figure 5.1
● 57
BBC Microbit UK 160929.indd 57
25-11-16 12:04