Skip to content


Meet your micro:bit

初級 | MakeCode, Python | LED表示, ボタン, 加速度センサー, | シーケンス, センサー, 入出力, 反復処理, 抽出

ステップ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?
  • micro:bitにどのくらいの光が落ちているかによって異なります。 micro:bitのLED出力は入力、 光センサーとしても動作します。
  • コードは 'if ... th... else' 文を使用します。 これは selection、または 条件 ステートメントとして知られています。 の場合、明るさが 50 以下であることをテストします。 の場合、明るさが 以下であることをテストします。 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.


  • 2~3人ごとに少なくとも1つのmicro:bit
  • バッテリーパック(オプション)
  • micro:bit V1で音を聞くためのヘッドフォンとワニ口クリップ付きコード(オプション)


ステップ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?