الخطوة 1: اصنعها
Start discovering some of the things the BBC micro:bit can do with this interactive investigation.
These two videos show you what it does and how to code it:
كيف يعمل ؟
You can use this project as an introductory exploration activity for anyone new to the micro:bit.
Copy the code on to some micro:bits, and start investigating what it does. What events make the micro:bit respond? What inputs and outputs is it using? What programming concepts might be making it work?
Then examine the code to see how instructions in code blocks tell the micro:bit what to do:
- Instructions in the ‘on start’ block run once only, when the micro:bit is reset or is powered on. The 'show icon' block shows a happy face on the LED display output.
- Events make different things happen when you press different input buttons. The 'on button A pressed' block is triggered when you press button A. Your micro:bit then shows a square zooming in quickly, then zooming out more slowly.
- The animation is made by showing different images in a sequence. Pausing for shorter and longer times controls the speed of the animation.
- Pressing button B shows how the micro:bit can scroll text on the LED display output using the 'show string' block. 'Strings' are what we call collections of letters and symbols stored in a computer.
- Press button A and B together to reveal a puzzle. You'll either see a sun or a moon. Can you work out what determines which picture is shown?
- It depends how much light is falling on your micro:bit. The micro:bit's LED output can also work as an input, a light sensor.
- The code uses an 'if... then... else' statement. This is known as selection, or a conditional statement. It tests if the light level is below 50. If it is, then it shows a sun. Otherwise, else, it shows a moon.
- The 'on shake' block reacts to information from the micro:bit's accelerometer sensor input. When you shake your micro:bit, it shows a surprised face for one second.
- If you have a micro:bit V2 or connect headphones or a speaker to your micro:bit, you'll also hear different sounds when each different input event happens.
- At least one micro:bit for every 2-3 people
- Battery packs (optional)
- Headphones and crocodile clip leads to hear sound on micro:bit V1 (optional)
You may also find our Set up guide useful to learn more about how to transfer code from the editor to a real micro:bit.
الخطوة 2: برمجها
الخطوة 3: حسّنها
- Modify the code to make your own 'Meet your micro:bit' project with different pictures, animations and sounds.
- Add extra inputs: can you make your micro:bit react to gestures other than 'shake'? React to pressing pins? Or, if you have the micro:bit V2 with built-in speaker, react to loud sounds or touching the logo?