pxt-calliope/docs/about.md

69 lines
2.6 KiB
Markdown
Raw Normal View History

2016-04-05 19:36:23 +02:00
```sim
basic.forever(() => {
basic.showString("Hi!");
})
2016-04-13 22:37:30 +02:00
input.onButtonPressed(Button.A, () => {
led.stopAnimation();
basic.showLeds(`
. . . . .
. # . # .
. . . . .
# . . . #
. # # # .`);
});
input.onButtonPressed(Button.B, () => {
led.stopAnimation();
basic.showLeds(`
. # . # .
# . # . #
# . . . #
. # . # .
. . # . .`);
});
2016-04-05 19:36:23 +02:00
```
2016-03-29 01:35:51 +02:00
# About
2016-03-29 08:18:21 +02:00
The [BBC micro:bit](https://www.microbit.co.uk) 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-29 01:35:51 +02:00
2016-05-18 20:28:15 +02: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-29 01:35:51 +02:00
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
2016-06-15 20:04:06 +02:00
## Hardware: The Device
2016-07-12 10:46:46 +02:00
Learn about the [hardware components](/device) of the micro:bit to make the most of it!
2016-06-15 20:04:06 +02:00
## Programming: Blocks or JavaScript
2016-03-29 01:35:51 +02:00
2016-06-17 18:01:29 +02:00
The student can program the BBC micro:bit using [Blocks](/blocks) or [JavaScript](/javascript), via the [micro:bit APIs](/reference):
2016-03-29 01:35:51 +02:00
```blocks
2016-06-09 20:10:01 +02:00
basic.showString("Hi!");
2016-03-29 01:35:51 +02:00
```
2016-06-15 20:04:06 +02:00
## Compile and Flash: Your Program!
2016-03-29 01:35:51 +02:00
2016-06-13 20:49:07 +02:00
When a user has her code ready, she can connect her BBC micro:bit to a computer via a USB cable, so it appears as a mounted drive (named MICROBIT).
2016-03-29 01:35:51 +02:00
2016-06-17 18:01:29 +02:00
Compilation to ARM thumb machine code from [Blocks](/blocks) or [JavaScript](/javascript) happens in the browser.
2016-03-29 01:35:51 +02:00
The student is prompted to save the ARM binary program to a file, which she then simply drags to the micro:bit mounted drive,
which flashes the micro:bit device with the new program.
## Simulator: Test Your Code
2016-06-13 20:49:07 +02:00
2016-03-29 01:35:51 +02:00
Before a student compiles her code for the micro:bit, she can run it using the micro:bit simulator, all within the confines of a web browser.
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
## C++ Runtime
2016-04-09 01:57:37 +02:00
The [C++ BBC 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-29 01:35:51 +02:00
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).
2016-06-09 20:10:01 +02:00
2016-06-15 13:55:19 +02:00
The [micro:bit library](/reference) mirrors the functions of the C++ library.
2016-03-29 08:18:21 +02: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 20:10:01 +02:00
## Open Source
The editor for the BBC micro:bit is [open source](/open-source) on GitHub. Contributors are welcome!