BBC micro:bit

BBC microbit
Koen Timmers

Educator - Author - Keynote speaker - Global Teacher Prize 2017 and 2018 finalist

Introduction

micro:bit

The BBC micro:bit is a new pocket-sized computer that lets anyone code, customise and use control other pieces of hardware through software. It's being supplied to around 1 million school children in a bid to address a growing skills shortage in the UK's technology sector. After that, the Micro Bit will go on sale outside of schools through a not-for-profit organisation set up by the BBC. The micro:bit is designed to work with mobile devices to spur classroom creativity, and with the micro:bit anyone can make their own smart device with very little code.

Buttons give you the opportunity to add control to your BBC micro:bit. Use them to start an animation, begin recording data, control a game or anything else you can imagine. The BBC micro:bit contains an accelerometer which can detect if you are shaking it or which way the micro:bit is being held. As well as detecting if it’s upside down, accelerometers can detect some of the forces that are acting on it. You can write a program for microbit that will tell you how high you threw your BBC micro:bit into the air!

The sky is clearly the limit! Some pupils from Rishworth School sent a micro:bit into space! 

Read how they did it: http://microbitgadgets.co.uk/ground-control-to-microbit. Check some cool applications at http://twitter.com/microbitgadgets

Coding

The microbit can be coded via Javascript (launch code editor), Microsoft Block Editor (launch code editor) and Microsoft Touch Develop (launch code editor).

Getting started

Requirements

You need the following things to transfer and run a script on your BBC micro:bit:
  • A USB cable to connect your computer to your micro:bit, a PC running Windows 7 of later (or a Mac running OS X 10.6 or later) and access to the Internet

Step 1: Connect your BBC micro:bit to your computer

First, connect the BBC micro:bit:
  1. Connect the small end of the USB cable to the micro USB port on your BBC micro:bit.
  2. Connect the other end of the USB cable to a USB port on your computer.

Your computer should recognise your micro:bit as a new drive. 

Step 2: Compile your script

Navigate to https://www.microbit.co.uk in your browser. 

Hit "My scripts" in the right top corner. 

You now have to make a choice: creating a new script or editing an existing script

 

Creating a new script

Scroll to the bottom. Hit the button Create Code

Choose the language you are willing to code in: JavaScriptTouch Develop or MicroPython.

Let's choose Touch Develop

Change the name of the script in the grey area. 

Click in the blue area "add code here". 

Pick a function on the bottom: basic

Click on show leds. You now have to choose which leds to show:

Your code looks like this:

You can click on 400 to change the amount of milliseconds. 

You can now test your little program by clicking  on the top. 

In the right sidebar you can see a simulation. 

Now we want to bring our program to our very own micro:bit. 

Click on . A hex-file will be downloaded automatically. You now need to bring this hex-file to your micro:bit-device via the Explorer. 

And yes! Look at your Micro:bit!

Editing a script

Select a script in the left sidebar and click Edit

You will now be referred to Touch Develop, one of the 3 coding options. 

Navigate to https://www.microbit.co.uk/app/#create:hrvbin 

 

Prefer JavaScript? 

Navigate to https://www.microbit.co.uk/app/#create:tomwku. Click the button My scripts on the left. 

Change or add code and click Publish. 

Happy coding!

 

Want to know more? 

Getting started: 

Tags: 
by PLN Education

No related articles.