# BBC micro:bit Lesson #0

## Intro

So what is this unassuming little board? It's name is the [BBC micro:bit](https://en.wikipedia.org/wiki/Micro_Bit), and it is a little computer you can write programs for. It has various gadgets like buttons and lights that you can use to do all kinds of fun stuff. There's even a compass!

In this guide we'll briefly go over the main features of the BBC micro:bit, just so you have an idea what's going on. The main web site is at [www.microbit.org](http://microbit.org/) where you can go to find more information.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/748/medium800/microcontrollers_3530-18.jpg?1503682305)

The BBC part of the name stands for [British Broadcasting Corporation](https://en.wikipedia.org/wiki/BBC). There's a lot of [history](https://en.wikipedia.org/wiki/BBC_Micro) to why the BBC would get involved with making a little computer. But the short version is they did. And then they gave it away to every year 7 student in the British schools.

And now the little computer is making its way across the pond and into America. That's right, it's sorta like a British invasion.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/773/medium800/microcontrollers_invasion_crop.jpg?1503695937)

# BBC micro:bit Lesson #0

## Lesson Parts

Here's a run down of what you'll need to play with the BBC micro:bit.

# Required:
A **BBC micro:bit!** Of course, this is essential, and is required for all lessons.

&nbsp;

Available at Adafruit as either a [bundle](https://www.adafruit.com/product/3362) or [just the board](https://www.adafruit.com/product/3530).

![microcontrollers_3362-04.jpg](https://cdn-learn.adafruit.com/assets/assets/000/045/764/medium640/microcontrollers_3362-04.jpg?1503684314)

 **Micro USB Cable** any length. One comes with the bundle. Or you probably have one of these around, they're the most common USB cable.

&nbsp;

_ **Make sure its a data/sync cable!** _

&nbsp;

[USB cable available at Adafruit](https://www.adafruit.com/products/592)

![microcontrollers_usb_cable.jpg](https://cdn-learn.adafruit.com/assets/assets/000/045/765/medium640/microcontrollers_usb_cable.jpg?1503684681)

Info: 

# BBC micro:bit Lesson #0

## Take a Tour!

So let's take a look at this little doodad and see what it's got. There's stuff all over both sides of this thing. Not sure if anyone knows which is the front and which is the back, but here's what's on one side.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/749/medium800/microcontrollers_microbit_back_gray_labels.jpg?1503682769)

Compass? Accelerometer? Bluetooth? Neat.

But the other side may be even cooler. It's got two buttons which are useful. But the really cool thing is the 5 x 5 grid of little LED lights. That's 25 total LEDs. And each one can be turned on and off individually. You can even set the brightness!

![](https://cdn-learn.adafruit.com/assets/assets/000/045/750/medium800/microcontrollers_microbit_front_gray_labels.jpg?1503682787)

Along the bottom edge are a bunch of gold connection pads. The most important of these are the 5 bigs ones - the ones with the big holes. These will allow you to attach all kinds of additional items using alligator style clips. No soldering needed!

Now let's look at all this stuff in more detail. That is, if you want to. If not, go ahead and skip on to the Let's Code section to learn about programming. That's where the fun is at!

# BBC micro:bit Lesson #0

## Microcontroller

This little chip, called a microcontroller or processor, is the brains of the BBC micro:bit. It's what actually runs your programs.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/751/medium800/microcontrollers_microbit_mcu.jpg?1503682875)

This particular microcontroller is made by a company called Nordic Semiconductor and has the cryptic name of nRF51822. Did some one say Nerf? Wah? Meh, it's just what they call it. It's probably 'n' for Nordic, and 'RF' for radio frequency or something. Don't worry about.

You also don't need to know these details, but it's kind of fun to geek out about them:

- It's a 32-bit ARM Cortex M0 running at 16MHz
- It has 256KB of flash memory
- It has 16KB of ram
- It has a 2.4 GHz Bluetooth low energy radio

# BBC micro:bit Lesson #0

## Battery Jack & Supply

You can provide power to the BBC micro:bit two ways - through the USB cable or via battery. The main way to program the BBC micro:bit is through the USB cable. However, once you've uploaded your program, you can use battery power to make your project mobile.

Here's where you connect the battery pack:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/752/medium800/microcontrollers_microbit_jst.jpg?1503682941)

This little plastic connector is called a [JST PH connector](https://en.wikipedia.org/wiki/JST_connector). The battery pack that comes with the Go Bundle has the correct part to plug in there. The battery packs that Adafruit sell also come with the correct connector. Just plug and go.

Here's a matching cable

### JST PH 2-Pin Cable - Female Connector 100mm

[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)
Red and black tinned wires with a 2-pin JST PH connector on the end. 4" / 100mm long. Matches up nicely with our Lipoly chargers!

[We have the socket 'mating' version of this cable](https://www.adafruit.com/product/3814) over here, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/261)
[Related Guides to the Product](https://learn.adafruit.com/products/261/guides)
![Top view shot of a red and black JST PH 2-Pin Cable to Female Connector - 100mm.](https://cdn-shop.adafruit.com/640x480/261-01.jpg)

Warning: 

# Choosing Battery Power Supply

Powering via battery is a little different than powering via USB. The on board voltage regulator is bypassed, so you need to pick your battery supply carefully. See here for some guidance:

[http://tech.microbit.org/hardware/powersupply/](http://tech.microbit.org/hardware/powersupply/)

(thanks David Hamilton from Scotland for pointing this out!)

# BBC micro:bit Lesson #0

## USB Connection

This is where you plug in the USB cable for programming. It is also one of the two ways of providing power to the board.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/753/medium800/microcontrollers_microbit_usb.jpg?1503682996)

One end of the USB cable will attach here while the other end will got to a USB port on the computer you use to write your programs. We'll talk about how to actually do all that later.

If you are using the USB cable from the Go Bundle, then you're set. If you are using one of your own USB cables, make sure it is a good one. While the world is full of USB cables, not all of them are made equal.

Danger: 

# BBC micro:bit Lesson #0

## Status LED

So small you may have missed it. But it's there. This little yellow LED will turn on and sometimes do a little blink dance to let you know stuff is happening. Just let it do its thing.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/754/medium800/microcontrollers_microbit_status_led.jpg?1503683036)

Info: 

# BBC micro:bit Lesson #0

## Reset Button

Sometimes you want to have your program start all over. That's what this reset button will do. You don't need to write anything in your program to use it, it will just happen. Press it and it will "reset" everything to the beginning.

Be careful though, maybe you don't want that to happen. That's why it's put on a different side than the other two buttons.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/755/medium800/microcontrollers_microbit_reset.jpg?1503683069)

# BBC micro:bit Lesson #0

## Bluetooth Antenna

Just so you know where it is, the antenna used to communicate over Bluetooth is located here. You can kind of see it if you hold the board just right in the light. It looks like a square squiggle snake thing.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/763/medium800/microcontrollers_microbit_antenna.jpg?1503683675)

The actual hardware that does the Bluetooth communications is part of the main microcontroller (processor). This is just the antenna part, so maybe don't wrap that area in tinfoil or go drilling holes in it or something.

# BBC micro:bit Lesson #0

## Compass

Which way is North? Well, a compass can tell you. And the BBC micro:bit has a little one right here:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/756/medium800/microcontrollers_microbit_compass.jpg?1503683183)

It's actually more like a magnet sensor. The Earth has a magnetic field that you can use to find North. However, anything else with a magnetic field will also be seen by the compass and can throw off the readings. Lot's of electrical devices generate magnetic fields, so you want to be sure and be away from them if you want to find out where North is.

# BBC micro:bit Lesson #0

## Accelerometer

The traffic light just turned green. Hit the gas and accelerate! That's what this little sensor called an accelerometer will measure:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/757/medium800/microcontrollers_microbit_accelo.jpg?1503683217)

You can also generate acceleration by shaking the BBC micro:bit. This will let you do things like have parts of your program start only when the board is shaken. Like shaking dice or something.

# BBC micro:bit Lesson #0

## Edge Connector

Look at all those gold teeth! Yep, there's a lot of connections along the bottom edge of the BBC micro:bit.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/758/medium800/microcontrollers_microbit_edge_connector.jpg?1503683402)

They do all kinds of crazy things as you can see in the image below. You can even get a [special connector](https://www.adafruit.com/product/3342) to make using them easier. The big brain of the BBC micro:bit can do a lot of things, and they just wanted to make sure there was a place to get access to them.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/774/medium800/microcontrollers_edge_connector.jpg?1503702725)

Info: 

# BBC micro:bit Lesson #0

## Buttons

Buttons are super useful, and the BBC micro:bit has two of them right here. One's called A and one's called B. There's a little label next to them that shows this.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/759/medium800/microcontrollers_microbit_buttons.jpg?1503683457)

These are your primary form of input. This is how you'll tell the BBC micro:bit to do something or start some action. Like "Hey, I just pressed this button, now blink me some LEDs!" Maybe one button can be "start" and one can be "stop". Or "faster" and "slower". Or "brighter" and "dimmer". It's up to you.

# BBC micro:bit Lesson #0

## LED Matrix

OK, this is probably the coolest feature of the BBC micro:bit. It's a 5x5 matrix of little LEDs. 5 rows. 5 columns. 5x5=25. Right in the middle of the board.

Check them out:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/760/medium800/microcontrollers_microbit_leds.jpg?1503683484)

With this 5x5 matrix of LEDs, you can do all sorts of neat things. Each one can be turned on and off individually. So you can draw patterns like hearts and smiley faces. There's even a way to scroll text messages across the display, like "HELLO WORLD!" or "MIND THE GAP!".

# BBC micro:bit Lesson #0

## Pads

Those 5 pads with the big holes are labeled on this side of the board. You will use these to attach various external devices, typically using alligator clips.

The first 3 are labeled 0, 1, and 2. Each one of these is like the other, they can either be an input or an output. And you get 3 of them to use.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/761/medium800/microcontrollers_microbit_pads.jpg?1503683548)

Info: 

These next two are a little different. They are labeled 3V and GND and are related to power. The 3V stands for "three volts", which refers to the voltage level of the power source. The GND stands for "ground", because everybody needs something to stand on, right? Three volts can't just float in space!

![](https://cdn-learn.adafruit.com/assets/assets/000/045/762/medium800/microcontrollers_microbit_power_pads.jpg?1503683568)

# BBC micro:bit Lesson #0

## Let's Code

Alright, so how do you program this thing? You've got two main options:

- [**JavaScript Blocks Editor**](https://makecode.microbit.org) - drag and drop visual blocks
- [**Python Editor**](http://python.microbit.org) - write code in Python

The really cool thing about both of these is that you do not need to download or install any software. Everything is done using a web browser - which pretty much every computer comes with these days. We'll briefly show how this is done for both options. More details can be found here: [http://microbit.org/code/](http://microbit.org/code/)

# It's Like a USB Thumb Drive!

The other cool feature of the BBC micro:bit is that it behaves and looks just like a [USB thumb drive](https://en.wikipedia.org/wiki/USB_flash_drive) to your computer. This is the other key feature that means no additional software or drivers need to be installed. Pretty much every computer supports USB storage devices.

**Uploading a program to the BBC micro:bit is like putting a JPG image on a USB thumb drive to share with someone.**

# BBC micro:bit Lesson #0

## JavaScript Blocks Editor

Navigate your web browser to the following location:

[https://makecode.microbit.org/](https://makecode.microbit.org/)

and you should get a window that looks like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/938/medium800/microcontrollers_javascript_blocks_main.jpg?1504132086)

We'll go over more details of this editor and all its features in a separate guide. Here we'll just run through a quick example to show the basics of creating and uploading a program.

Info: 

There are three main areas as shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/937/medium800/microcontrollers_javascript_blocks_main_areas.png?1504131792)

These three areas are:

1. **The Simulator**
2. **The Pallet**
3. **The Coding Area**

To write programs, you drag blocks from the **pallet (2)** on to the **coding area (3)** and snap them together. The **simulator (1)** will update on the fly to show the resulting program running on a virtual BBC micro:bit.

# Hello Heart Example

Let's show a very short example.

Click on the item in the pallet named **Basic**. This will bring up a variety of block items you can choose from as shown below.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/939/medium800/microcontrollers_javascript_blocks_basic_01.jpg?1504132107)

Now click and drag the item named **show leds** on to the coding area.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/940/medium800/microcontrollers_javascript_blocks_basic_02.jpg?1504132117)

Now drag the **show leds** block so that it "clicks" in to the **on start** block. To do this, you line up the little tab and notch as shown below. Kind of like putting Legos together.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/784/medium800/microcontrollers_drag_it.png?1503769767)

And now it should look like this (I moved the **forever** block down just to get it out of the way):

![](https://cdn-learn.adafruit.com/assets/assets/000/045/941/medium800/microcontrollers_javascript_blocks_basic_03.jpg?1504132142)

Now you can click the individual little squares in the **show leds** block to create a pattern. What you are doing is setting which LEDs in the 5x5 matrix are either on or off. They just toggle on and off, so you can just keep clicking until you come up with something you like.&nbsp; I did a heart:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/942/medium800/microcontrollers_javascript_blocks_basic_04.jpg?1504132182)

OK, done coding! Now let's download this program to the BBC micro:bit. Press the big button down at the bottom that says **Download** :

![](https://cdn-learn.adafruit.com/assets/assets/000/045/944/medium800/microcontrollers_javascript_blocks_example_04_download.png?1504132371)

What happens next will depend on what operating system you are using and what browser you are using. But what is happening is that a file was created by the Javascript Blocks Editor and it is trying to send it to you. The file is called **mircobit-Untitled.hex** and you just need to save it somewhere on your computer.

Info: 

Info: 

Info: 

You will likely be prompted to save the file somewhere as shown below.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/943/medium800/microcontrollers_javascript_blocks_basic_05.jpg?1504132195)

Go ahead and save it and make note of the location where it was saved. I put mine in my Documents folder.

Now imagine that hex file you saved is a JPG image file and that the BBC micro:bit is a USB thumb drive. The process for uploading the program (the hex file) to the BBC micro:bit is the same process you would use for copying the JPG image file onto a USB thumb drive.

Connect the BBC micro:bit to a USB port on your computer. A folder name MICROBIT should appear. Next, open the folder where you saved the hex file from above. Now simply drag the hex file into the MICROBIT folder.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/789/medium800/microcontrollers_javascript_blocks_example_04_dragdrop.png?1503772122)

The little yellow status LED on the BBC micro:bit will blink as the file is uploaded. Once complete, the status LED should stop blinking and you should see your pattern on the 5x5 LED matrix.

Neat! And that's the basic process for writing and uploading a program using the Javascript Blocks Editor.

# BBC micro:bit Lesson #0

## Python Editor

Navigate your web browser to the following location:

[http://python.microbit.org](http://python.microbit.org)

and you should get a window that looks like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/045/945/medium800/microcontrollers_python_main.jpg?1504132428)

This is a much simpler layout than the JavaScript Blocks Editor. You basically write your Python code in the text editor, and then click Download when you're ready to download the code to the BBC micro:bit.

The web page even loads with a basic demo program already written. We won't go into details of programming in Python in this guide, but what this program does is scroll the message "Hello, World!" across the LEDs and then display a heart. It will repeat this every 2 seconds. Let's just go ahead and use this program as is.

There's no code for us to write, so just click the **Download** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/946/medium800/microcontrollers_python_editor_download.png?1504132559)

You'll be prompted for a location to save the file. This is just like what happened when using the JavaScript Blocks Editor. Just pick a location you want to save it.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/947/medium800/microcontrollers_python_save.jpg?1504132579)

This step is also the same as the JavaScript Blocks Editor. Just drag and drop the hex file saved from the previous step on to the BBC micro:bit. Don't forget to plug it in to your computer using the USB cable.

![](https://cdn-learn.adafruit.com/assets/assets/000/045/794/medium800/microcontrollers_python_editor_dragdrop.jpg?1503782393)

And that's it! You should get the "Hello, World!" message scrolling across the LEDs followed by a cute heart symbol.

# BBC micro:bit Lesson #0

## What Next?

This guide was meant to simply provide an introductory overview of the BBC micro:bit hardware and the basic process for programming it. There's a lot more to discover and learn playing around with this little board. We hope to cover those in separate guides. But if you were able to get the JavaScript Blocks and Python examples to work, you are ready to move on!

Have fun. The sky is not the limit!

![](https://cdn-learn.adafruit.com/assets/assets/000/045/806/medium800/microcontrollers_microbit_in_space.jpg?1503846045)


## Featured Products

### BBC micro:bit Go Bundle

[BBC micro:bit Go Bundle](https://www.adafruit.com/product/3362)
Discontinued - [**you can grab** micro:bit v2 Go Bundle - Batteries and USB Cable Included **instead!&nbsp;**](https://www.adafruit.com/product/4834)

The British Invasion is here! No, not music...microcontrollers! New to the USA is the newest and _easiest_ way to...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3362)
[Related Guides to the Product](https://learn.adafruit.com/products/3362/guides)
### BBC micro:bit

[BBC micro:bit](https://www.adafruit.com/product/3530)
The British Invasion is here! No, not music...microcontrollers! New to the USA is the newest and _easiest_ way to learn programming and electronics - the **BBC micro:bit**.

Designed specifically for kids and beginners, the&nbsp; **micro:bit** &nbsp;is a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3530)
[Related Guides to the Product](https://learn.adafruit.com/products/3530/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

Out of Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
### Small Alligator Clip Test Lead (set of 12)

[Small Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1008)
Connect this to that without soldering using these handy mini alligator clip test leads. 15" cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a multimeter so we...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1008)
[Related Guides to the Product](https://learn.adafruit.com/products/1008/guides)
### Small Alligator Clip to Male Jumper Wire Bundle - 12 Pieces

[Small Alligator Clip to Male Jumper Wire Bundle - 12 Pieces](https://www.adafruit.com/product/3255)
For bread-boarding with unusual non-header-friendly surfaces, these cables will be your best friends! No longer will you have long strands of alligator clips that are grabbing little wires. These compact jumper cables have a premium male header on one end, and a grippy mini alligator clip on...

In Stock
[Buy Now](https://www.adafruit.com/product/3255)
[Related Guides to the Product](https://learn.adafruit.com/products/3255/guides)
### 2x40 Right Angle Edge Connector for micro:bit

[2x40 Right Angle Edge Connector for micro:bit](https://www.adafruit.com/product/3342)
This is a connector that fits directly to the edge contacts of a BBC [micro:bit](https://www.adafruit.com/products/3362). The connector has 80 pins, but because of the different widths of the micro:bit edge contacts, some of the micro:bit contacts will map to more than one of this...

In Stock
[Buy Now](https://www.adafruit.com/product/3342)
[Related Guides to the Product](https://learn.adafruit.com/products/3342/guides)

## Related Guides

- [Esenciales para CircuitPython](https://learn.adafruit.com/esenciales-para-circuitpython.md)
- [MIDI Stomping Pads](https://learn.adafruit.com/midi-stomping-pads.md)
- [CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials.md)
- [Ping Pong Ball Launcher](https://learn.adafruit.com/ping-pong-ball-launcher-with-cpx.md)
- [Affordable HAL 9000 Replica](https://learn.adafruit.com/hal-9000-replica.md)
- [Blinka Says Tabletop Arcade Game](https://learn.adafruit.com/blinka-says-tabletop-arcade-game.md)
- [Circuit Playground Express: Piano de Limones](https://learn.adafruit.com/circuit-playground-express-piano-de-limones.md)
- [Snake Charmer Box](https://learn.adafruit.com/snakecharmer.md)
- [Color Remote with Circuit Playground Bluefruit](https://learn.adafruit.com/color-remote-with-circuit-playground-bluefruit.md)
- [FruitBox Sequencer: Musically Delicious Step Pattern Generator ](https://learn.adafruit.com/circuitpython-fruitbox-sequencer-musically-delicious-step-pattern-generator.md)
- [Circuit Playground Sound-Controlled Robot](https://learn.adafruit.com/circuit-playground-sound-controlled-robot.md)
- [Using EduBlocks with Circuit Playground Express](https://learn.adafruit.com/using-edublocks-with-circuit-playground-express.md)
- [Lucky Cat with Circuit Playground Express](https://learn.adafruit.com/lucky-cat-with-circuit-playground-express.md)
- [Micro:Bit Puppet "Text Message" System!](https://learn.adafruit.com/micro-bit-radio-controlled-puppet.md)
- [MagicLight Bulb Color Mixer with Circuit Playground Bluefruit](https://learn.adafruit.com/magiclight-bulb-mixer.md)
