2016-09-14 08:14:04 -07:00
![](/static/mb/device/pano.jpg)
2016-03-28 16:35:51 -07:00
# About
2017-09-07 13:42:08 -07:00
## @description A Blocks / Javascript code editor for the micro:bit, a pocket-size computer with 5x5 display, sensors and Bluetooth.
2016-08-17 09:44:15 -07:00
2017-03-08 05:01:11 -08:00
The [BBC micro:bit ](https://microbit.org ) is a [pocket-size computer ](/device ) with a 5x5 display of 25 LEDs, Bluetooth and sensors that can be programmed by anyone. The BBC micro:bit was made possible by many [partners ](https://www.microbit.co.uk/partners ).
2016-03-28 16:35:51 -07:00
2016-05-18 11:28:15 -07:00
The micro:bit provides an easy and fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it.
2016-03-28 16:35:51 -07:00
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
2016-09-14 08:14:04 -07:00
* [Read the docs ](/docs )
## [Hardware: The Device](/device)
2016-06-15 14:04:06 -04:00
2016-09-14 08:14:04 -07:00
The BBC micro:bit is packaged with sensors, radio and other goodies. Learn about the [hardware components ](/device ) of the micro:bit to make the most of it!
2016-06-15 14:04:06 -04:00
2017-09-07 13:42:08 -07:00
## ~ hint
2017-03-08 05:01:11 -08:00
**Looking to buy a micro:bit?** See the [list of resellers ](https://microbit.org/resellers ).
2017-09-07 13:42:08 -07:00
## ~
2017-03-08 05:01:11 -08:00
2016-09-14 08:14:04 -07:00
## Programming: [Blocks](/blocks) or [JavaScript](/javascript)
2016-03-28 16:35:51 -07:00
2016-09-14 08:14:04 -07:00
You can program the micro:bit using [Blocks ](/blocks ) or [JavaScript ](/javascript ) in your web browser via the [micro:bit APIs ](/reference ):
2016-03-28 16:35:51 -07:00
2016-09-14 08:14:04 -07:00
```block
2016-07-21 15:32:59 -07:00
input.onButtonPressed(Button.A, () => {
basic.showString("Hi!");
})
2016-03-28 16:35:51 -07:00
```
2016-09-14 08:14:04 -07:00
```typescript
input.onButtonPressed(Button.A, () => {
basic.showString("Hi!");
})
```
The editor work in [most modern browsers ](/browsers ), work [offline ](/offline ) once loaded and do not require any installation.
2016-03-28 16:35:51 -07:00
2016-09-14 08:14:04 -07:00
## [Compile and Flash: Your Program!](/device/usb)
2016-03-28 16:35:51 -07:00
2016-07-14 12:09:40 -07:00
When you have your code ready, you connect your micro:bit to a computer via a USB cable, so it appears as a mounted drive (named MICROBIT).
2016-03-28 16:35:51 -07:00
2016-07-14 12:09:40 -07:00
Compilation to ARM thumb machine code from [Blocks ](/blocks ) or [JavaScript ](/javascript ) happens in the browser. You save the ARM binary
program to a file, which you then copy to the micro:bit drive, which flashes the micro:bit device with the new program.
2016-03-28 16:35:51 -07:00
## Simulator: Test Your Code
2016-06-13 14:49:07 -04:00
2016-07-14 12:09:40 -07:00
You can run your code using the micro:bit simulator, all within the confines of a web browser.
2016-03-28 16:35:51 -07:00
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
2016-09-14 08:14:04 -07:00
```sim
basic.forever(() => {
basic.showString("Hi!");
})
input.onButtonPressed(Button.A, () => {
led.stopAnimation();
basic.showLeds(`
. . . . .
. # . # .
. . . . .
# . . . #
. # # # .`);
});
input.onButtonPressed(Button.B, () => {
led.stopAnimation();
basic.showLeds(`
. # . # .
# . # . #
# . . . #
. # . # .
. . # . .`);
});
```
2017-06-24 19:50:00 -07:00
## Learn!
We have tons of [projects ](/projects ), [examples ](/examples ) and [courses ](/courses ) to get your started!
2016-03-28 16:35:51 -07:00
## C++ Runtime
2016-07-14 12:09:40 -07:00
The [C++ micro:bit runtime ](http://lancaster-university.github.io/microbit-docs/ ), created at [Lancaster University ](http://www.lancaster.ac.uk/ ), provides access to the hardware functions of the micro:bit,
2016-03-28 16:35:51 -07:00
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).
2016-06-09 11:10:01 -07:00
2016-06-15 07:55:19 -04:00
The [micro:bit library ](/reference ) mirrors the functions of the C++ library.
2016-03-28 23:18:21 -07:00
When code is compiled to ARM machine code, the calls to JavaScript micro:bit functions are replaced with calls to the corresponding C++ functions.
2016-06-09 11:10:01 -07:00
2016-09-14 08:14:04 -07:00
## [Command Line Tools](/cli)
2017-07-24 13:39:27 -07:00
Looking to use @homeurl @ in your favorite editor? Install the [command line tools ](/cli ) and get rolling!
2016-09-14 08:14:04 -07:00
## [Packages](/packages)
Create, edit and distribute your own blocks and JavaScript using [packages ](/packages ). Packages are hosted on GitHub and may be written
using C++, JavaScript and/or ARM thumb.
## [Open Source](/open-source)
2016-06-09 11:10:01 -07:00
2016-07-14 12:09:40 -07:00
The code for the micro:bit is [open source ](/open-source ) on GitHub. Contributors are welcome!