micro:bit


Resources, programs and examples for the BBC micro:bit

BBC micro:bit in mbed

Welcome to the micro:bit team. This is the place for collecting community activity in mbed around the BBC micro:bit. Here you will find examples, samples and discussion of how you can use the micro:bit and other things you can do with it!

Information

If you'd like to use the official environments created as part of the BBC micro:bit project, these can all be found at microbit.co.uk. The information here relates to using ARM's mbed development environment with a micro:bit.

If you're new to programming, starting with the official editors will give a much less steep learning curve and there are tutorials and guides that work through basic principles. The mbed environment is very easy to use, but expects some familiarity with C/C++ syntax.

Getting Started

The micro:bit is based on mbed technology and can be used as if it were any other mbed Enabled development board.

If you're familiar with using mbed, head over the the micro:bit Platform Page and start developing.

If you're newer to using the mbed World, then you can find some useful instructions here:

https://lancaster-university.github.io/microbit-docs/online-toolchains/

The DAL

Lancaster University have written a C/C++ abstraction for the micro:bit that includes an event scheduler and message bus, which is useful both for individual users and for higher level languages, such as Python and TouchDevelop to target

You can see the internals of this in the Lancaster University team

You don't have to use this when using the micro:bit, but it makes a huge number of things much easier. It's written in a componentised fashion and so you can take only the bits you need.

The following example programs includes many samples of how to use the MicroBit class. They are cloned in from the microbit-samples repository on GitHub

Import programmicrobit-hello-world

An example of how to use the micro:bit DAL's abstraction for a simple 'Hello World' on the micro:bit display. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

Import programmicrobit-button-events

A simple example of how to use the buttons on the micro:bit with the DAL. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

Import programmicrobit-accelerometer

An example of how to us the micro:bit DAL's accelerometer abstraction. This is a one-way sync from GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

Import programmicrobit-logic-gates

This example shows the use of the 'Pins' (edge connector) and the DAL to make a logic gate simulator from a micro:bit - many of these can be wired together to create logic networks. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

Import programmicrobit-invaders

A space invaders game using the micro:bit. This example uses buttons, 'fibers' (like threads or tasks), the display, and the sleep functions. It is one of the more elaborate examples useful for someone wanting to build a game or understand the scheduler. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

[Not found]

There are more examples on the 'code' tab of this team.

This example, taken from the advanced guide shows using just the display component:

Import programmicrobit-component-display

Example display component code from http://lancaster-university.github.io/microbit-docs/advanced/#using-components-directly

Other places to find information

There is very good documentation of the DAL We're trying to create a StackExchange instance for the micro:bit - Please sign up over there if you think that it would be helpful - at this point, StackExchange requires that we demonstrate a lot of people interested in participating in the forum before creating it, so the more people, the better!

Sharing your examples

If you'd like to share your examples so that they show up here, please request to join this micro:bit team. After you've done that you can publish a program 'into' the team and it will be visible for all to see.

Code

  • Mbed 2 deprecated
    microbit_presenter

    Based on the example USB HID keyboard https://developer.mbed.org/users/jbru/code/BLE_HID_KeyboardStreamDemo/

    HID, hogp, KB, keyboard
    Last updated: 14 Nov 2018 4 329
  • microbit-battery-test

    An example of testing the micro:bit battery without any external components

    Battery, micro:bit, Microbit
    Last updated: 28 Sep 2017 2 68
  • microbit-proximity-heart

    An example using the DAL's radio module that sends and recieves messages to let you know when someone is nearby. This is a one-way translation of the microbit-samples repository on …

    Last updated: 22 Jul 2016 2 155
  • microbit-snake

    An example of a simple snake game on the micro:bit. This example shows the use of the accelerometer and plotting pixels on the display. This is a one-way translation of …

    Last updated: 13 Jul 2016 1 165
  • microbit-simple-radio-tx

    An example of how to us the micro:bit DAL's abstraction. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push …

    Last updated: 13 Jul 2016 1 208
  • microbit-simple-radio-rx

    An example of how to us the micro:bit DAL's abstraction. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push …

    Last updated: 13 Jul 2016 1 168
  • microbit-simple-animation

    An example of how to us the micro:bit DAL's abstraction. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push …

    Last updated: 13 Jul 2016 1 78
  • microbit-logic-gates

    This example shows the use of the 'Pins' (edge connector) and the DAL to make a logic gate simulator from a micro:bit - many of these can be wired together …

    Last updated: 13 Jul 2016 1 105
  • microbit-invaders

    A space invaders game using the micro:bit. This example uses buttons, 'fibers' (like threads or tasks), the display, and the sleep functions. It is one of the more elaborate examples …

    Last updated: 13 Jul 2016 1 427
  • microbit-hello-world

    An example of how to use the micro:bit DAL's abstraction for a simple 'Hello World' on the micro:bit display. This is a one-way translation of the microbit-samples repository on GitHub. …

    Last updated: 13 Jul 2016 1 4621
See all repositories