Getting Started With the Micro:bit

1,550

22

0

Published

Introduction: Getting Started With the Micro:bit

The micro:bit is a microcontroller - a small computer that lets you control electronics. It packs a lot of features on a tiny electronics board:

  • an accelerometer sensor to detect movement, angle and acceleration;
  • a magnetometer sensor to detect magnetic fields;
  • Bluetooth and USB ports to connect to your computer or to other micro:bits;
  • 25 programmable LEDs;
  • two programmable buttons;
  • 5 ring connectors and 23 edge connectors for extra fun and features!

The micro:bit powers through its USB port connected to your computer or a battery pack.

Step 1: Getting to Know Makecode

The easiest ways to get started programming your micro:bit is to use MakeCode, a block-programming website that lets you drag and drop, well, blocks to tell your micro:bit what to do. It even has a simulator so you can check your program before sending it to your micro:bit!

We have attached a few block-programs to get you started, from making your micro:bit say "Hello" when you turn it on to showing whether it's happy or sad when you press on buttons A or B. Try them for yourself in your browser!

Everything is color-coded in MakeCode so you can easily remember where to find the block you need. For example:

  • the on start block is in the Basic category;
  • the on button pressed block is in the Input category, etc.

Take some time to explore these as well, or just type something in the Search... field on top of the categories if you're having a hard time finding it!

Step 2: Download and Transfer to Your Micro:bit

Once you're happy with your program, you can save it to your micro:bit the same way you would save to a flash drive:

  1. Connect your micro:bit to your computer with the USB cable in the box.
  2. Give a name to your program and save it by clicking on the floppy disk icon
  3. Click on the big Download button in at the bottom left of your MakeCode screen.
  4. Save the .hex file to your computer or even directly to your micro:bit.
  5. The lights on your micro:bit will flash while the file transfers.
  6. Congratulations, your program is running!

Step 3: More Programs: the Shake Counter

The Shake Counter counts how many time you shake your micro:bit, and resets to 0 when you press the A and B buttons together at the same time. Here's how:

  • The first block, on start, sets the counter to 0 and displays it.
  • The second block, on forever, makes sure the counter is always displayed while the micro:bit is on.
  • The third block, on shake, increases the counter by 1 everytime you shake the micro:bit
  • The fourth block, on A+B pressed, tells the micro:bit to reset the counter when we press the A and B buttons at the same time.

Try it for yourself, change a few things, simulate your changes in MakeCode and download it to your micro:bit!

Step 4: More Programs: the Countdown Timer

The Countdown Timer counts down from 10 to 0, and starts all over again when you press the A and B buttons together at the same time. Here's how:

  • The first block, on start, sets the counter to 10 and displays it.
  • The second block, forever, counts down from 10 to 0 until we reach 0.
  • The third block, on A+B pressed, lets us reset the counter to 10 if we press the A and B buttons together.

Try it for yourself, change a few things, simulate your changes in MakeCode and download it to your micro:bit!

Step 5: More Programs: the Micro:pet Rabbit

The micro:rabbit sits in your pocket: you can feed it and play with it - here's how:

  • the forever block displays the icon for your rabbit;
  • the on button A pressed block feed your rabbit and makes it smile;
  • the on button B pressed block lets your rabbit make a silly face;
  • the on button A+B pressed block makes your rabbit confused - are you trying to play, or are you trying to feed it?

Try it for yourself, change a few things, simulate your changes in MakeCode and download it to your micro:bit!

Step 6: Explore for More!

Congratulations, you're pretty much ready to keep exploring the micro:bit world on your own!

Here's a few more places to find cool ideas and programs:

The micro:bit website has a lot of projects and ideas for you to try - check it at http://www.microbit.org/ideas/.

People on Instructables are always happy to share what they do, and there are lots of projects for the micro:bit out there already! Find them at https://www.instructables.com/howto/microbit/.

Getting tired of block-programming? Then try MicroPython! It's a great programming language and you can find detailed instructions, tutorials, and an online code editor on the micro:bit website at http://microbit.org/guide/python/!

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest

    Discussions