AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Build it in small steps

Week 14 · 1.9 Physical computing · 3 lessons
1

Start with a prototype

Computing 9: Topic 1.9, pp. 155–167
GoalWrite the requirements for a micro:bit idea, choose the part to build first, and trace that first prototype by hand.
New words
requirement · something the program must do, written so that you can test itprototype · an early, simple version of a program, made to test an idea before the whole program is builtinterface · the part of a program that the user sees and presses, such as the buttons and the lights
Explanation

A micro:bit is a small computer with inputs, such as the buttons A and B and the shake sensor, and outputs, such as its 25 lights. Before you build a program for it, write down the requirements: what must the program do, and what will the user press or see? Then choose one small part to build first. This early version is a prototype. It may cover just one requirement. It may even be a dummy screen that shows the planned look, with no working code behind it. A prototype is cheap to make and quick to test, so mistakes in the idea show up early. If two micro:bits need to talk by radio, they must be set to the same group number, and this is better added after the first part works.

Part of the ideaOn the micro:bit
Inputbutton A, button B, shake
Processa variable that stores a number, an IF that chooses
Outputthe 5 × 5 lights: a number, a word or an icon
Worked examples
No.The micro:bit must …InputOutput
1count every jump and show the countshakethe number
2start again from 0button Bthe number 0
3praise the skipper at 10 jumps or moreshakea happy face
Requirements for a skipping-rope jump counter. A micro:bit is clipped to the rope handle, and every jump shakes it. The three requirements are numbered, so that each one can be tested on its own. Requirement 1 is the best one to build first, because the others depend on a number that is already counted.
Jump counter, version 1setjumpsto0on startchangejumpsby1show numberjumpson shake
The first prototype covers requirement 1 only. When the program starts, jumps is set to 0. Each shake adds 1 and shows the new number. The user shakes three times, so the lights show 1, then 2, then 3. Pressing B does nothing yet, because requirement 2 is not built.
ABlook of the happy face
A prototype of the interface only. This prototype does not count anything. It shows the user how the happy face for requirement 3 will look, when button A is pressed. It is useful for deciding whether the face is clear enough before the code behind it is written.
Class activity

Requirements on cards (no computer). Pick an invented micro:bit idea, such as a sign for a bedroom door or a counter for laps. Write each requirement on its own card: one sentence with an input and an output. Put the cards in the order in which you would build them, and give one reason for the first card. Swap with a partner: can they say what the first prototype would do, and what the lights would show after one press or one shake?

Practice
1
A sign for a bedroom door must show a yes icon when button A is pressed (come in), a no icon when button B is pressed (busy), and a sad face when the micro:bit is shaken (door closed). Write the three requirements and say which you would build first, and why.
2
The user presses button A three times. What do the lights show after each press?
Score countersetscoreto0on startchangescoreby2show numberscoreon buttonApressed
3
Which of these statements about a prototype are true? (a) It must contain every feature. (b) It can show only how the screen looks. (c) It is tested before more is added. (d) It can be a first version of one requirement.
4
Explain why it is cheaper to test a prototype of one requirement than to build the whole program first.