Name Date Size

..29-Nov-20194 KiB

.gitignoreH A D27-Sep-201834

.vscode/H23-Nov-20184 KiB

.yotta.jsonH A D27-Sep-201864

.yotta_ignoreH A D27-Sep-201816

debugOnVisualStudioCode.gifH A D23-Nov-20181.2 MiB

LICENSEH A D27-Sep-20181.2 KiB

module.jsonH A D23-Nov-2018280

README.mdH A D23-Nov-20184.5 KiB

source/H27-Sep-20184 KiB

README.md

1# microbit-samples
2
3A collection of example programs using the micro:bit runtime.
4
5The source/examples folder contains a selection of samples demonstrating the capabilities and usage of the runtime APIs.
6To select a sample, simply copy the .cpp files from the relevant folder into the source/ folder.
7
8e.g. to select the "invaders" example:
9
10```
11cp source/examples/invaders/* source
12```
13
14and then to compile your sample:
15
16```
17yt clean
18yt build
19```
20
21The HEX file for you micro:bit with then be generated and stored in build\bbc-microbit-classic-gcc\source\microbit-samples-combined.hex
22
23n.b. Any samples using the low level RADIO APIs (such as simple-radio-rx and simple-radio-tx) require the bluetooth capabilities of the
24micro:bit to be disabled. To do this, simply copy the config.json file from the sample to the top level of your project. Don't forget to
25remove this file again later if you then want to use Bluetooth! For example:
26
27
28```
29cp source/examples/simple-radio-rx/config.json .
30```
31
32
33## Overview
34
35The micro:bit runtime provides an easy to use environment for programming the BBC micro:bit in the C/C++ language, written by Lancaster University. It contains device drivers for all the hardware capabilities of the micro:bit, and also a suite of runtime mechanisms to make programming the micro:bit easier and more flexible. These range from control of the LED matrix display to peer-to-peer radio communication and secure Bluetooth Low Energy services. The micro:bit runtime is proudly built on the ARM mbed and Nordic nrf51 platforms.
36
37In addition to supporting development in C/C++, the runtime is also designed specifically to support higher level languages provided by our partners that target the micro:bit. It is currently used as a support library for all the languages on the BBC www.microbit.co.uk website, including Microsoft Block, Microsoft TouchDevelop, Code Kingdoms JavaScript and Micropython languages.
38
39## Links
40
41[micro:bit runtime docs](http://lancaster-university.github.io/microbit-docs/) | [microbit-dal](https://github.com/lancaster-university/microbit-dal) |  [uBit](https://github.com/lancaster-university/microbit)
42
43## Build Environments
44
45| Build Environment | Documentation |
46| ------------- |-------------|
47| ARM mbed online | http://lancaster-university.github.io/microbit-docs/online-toolchains/#mbed |
48| yotta  | http://lancaster-university.github.io/microbit-docs/offline-toolchains/#yotta |
49
50##  microbit-dal Configuration
51
52The DAL also contains a number of compile time options can be modified. A full list and explanation
53can be found in our [documentation](http://lancaster-university.github.io/microbit-docs/advanced/#compile-time-options-with-microbitconfigh).
54
55Alternately, `yotta` can be used to configure the dal regardless of module/folder structure, through providing a
56`config.json` in this directory.
57
58Here is an example of `config.json` with all available options configured:
59```json
60{
61    "microbit-dal":{
62        "bluetooth":{
63            "enabled": 1,
64            "pairing_mode": 1,
65            "private_addressing": 0,
66            "open": 0,
67            "whitelist": 1,
68            "advertising_timeout": 0,
69            "tx_power": 0,
70            "dfu_service": 1,
71            "event_service": 1,
72            "device_info_service": 1
73        },
74        "reuse_sd": 1,
75        "default_pullmode":"PullDown",
76        "gatt_table_size": "0x300",
77        "heap_allocator": 1,
78        "nested_heap_proportion": 0.75,
79        "system_tick_period": 6,
80        "system_components": 10,
81        "idle_components": 6,
82        "use_accel_lsb": 0,
83        "min_display_brightness": 1,
84        "max_display_brightness": 255,
85        "display_scroll_speed": 120,
86        "display_scroll_stride": -1,
87        "display_print_speed": 400,
88        "panic_on_heap_full": 1,
89        "debug": 0,
90        "heap_debug": 0,
91        "stack_size":2048,
92        "sram_base":"0x20000008",
93        "sram_end":"0x20004000",
94        "sd_limit":"0x20002000",
95        "gatt_table_start":"0x20001900"
96    }
97}
98```
99##  Debug on Visual Studio Code (Windows)
100
1011. build sample. You can build "HELLO WORLD! :)" program.
1022. Copy microbit-samples\build\bbc-microbit-classic-gcc\source\microbit-samples-combined.hex to micro:bit.
1033. Launch the Visual Studio Code
1044. File -> Open Folder... and select "microbit-samples" folder.
1055. Set break point to "main()" function.
1066. View -> Debug (Ctrl + Shift + D)
1077. Debug -> Start Debugging (F5)
108
109![Debug on Visual Studio Code](/debugOnVisualStudioCode.gif)
110
111## BBC Community Guidelines
112
113[BBC Community Guidelines](https://www.microbit.co.uk/help#sect_cg)
114