Samples of how to use the micro:bit DAL with mbed. This is a hg clone of the real git repo that can be found here: https://github.com/lancaster-university/microbit-samples
Dependencies: microbit
Fork of microbit-samples by
main.cpp@0:56b12ee8c8da, 2016-04-07 (annotated)
- Committer:
- JonnyA
- Date:
- Thu Apr 07 00:56:00 2016 +0000
- Revision:
- 0:56b12ee8c8da
Initial commit to contain all library files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JonnyA | 0:56b12ee8c8da | 1 | /* |
JonnyA | 0:56b12ee8c8da | 2 | The MIT License (MIT) |
JonnyA | 0:56b12ee8c8da | 3 | Copyright (c) 2016 British Broadcasting Corporation. |
JonnyA | 0:56b12ee8c8da | 4 | This software is provided by Lancaster University by arrangement with the BBC. |
JonnyA | 0:56b12ee8c8da | 5 | Permission is hereby granted, free of charge, to any person obtaining a |
JonnyA | 0:56b12ee8c8da | 6 | copy of this software and associated documentation files (the "Software"), |
JonnyA | 0:56b12ee8c8da | 7 | to deal in the Software without restriction, including without limitation |
JonnyA | 0:56b12ee8c8da | 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
JonnyA | 0:56b12ee8c8da | 9 | and/or sell copies of the Software, and to permit persons to whom the |
JonnyA | 0:56b12ee8c8da | 10 | Software is furnished to do so, subject to the following conditions: |
JonnyA | 0:56b12ee8c8da | 11 | The above copyright notice and this permission notice shall be included in |
JonnyA | 0:56b12ee8c8da | 12 | all copies or substantial portions of the Software. |
JonnyA | 0:56b12ee8c8da | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
JonnyA | 0:56b12ee8c8da | 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
JonnyA | 0:56b12ee8c8da | 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
JonnyA | 0:56b12ee8c8da | 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
JonnyA | 0:56b12ee8c8da | 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
JonnyA | 0:56b12ee8c8da | 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
JonnyA | 0:56b12ee8c8da | 19 | DEALINGS IN THE SOFTWARE. |
JonnyA | 0:56b12ee8c8da | 20 | */ |
JonnyA | 0:56b12ee8c8da | 21 | |
JonnyA | 0:56b12ee8c8da | 22 | #include "MicroBit.h" |
JonnyA | 0:56b12ee8c8da | 23 | |
JonnyA | 0:56b12ee8c8da | 24 | MicroBit uBit; |
JonnyA | 0:56b12ee8c8da | 25 | |
JonnyA | 0:56b12ee8c8da | 26 | int main() |
JonnyA | 0:56b12ee8c8da | 27 | { |
JonnyA | 0:56b12ee8c8da | 28 | // Initialise the micro:bit runtime. |
JonnyA | 0:56b12ee8c8da | 29 | uBit.init(); |
JonnyA | 0:56b12ee8c8da | 30 | |
JonnyA | 0:56b12ee8c8da | 31 | // Insert your code here! |
JonnyA | 0:56b12ee8c8da | 32 | uBit.display.scroll("HELLO WORLD! :)"); |
JonnyA | 0:56b12ee8c8da | 33 | |
JonnyA | 0:56b12ee8c8da | 34 | // If main exits, there may still be other fibers running or registered event handlers etc. |
JonnyA | 0:56b12ee8c8da | 35 | // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then |
JonnyA | 0:56b12ee8c8da | 36 | // sit in the idle task forever, in a power efficient sleep. |
JonnyA | 0:56b12ee8c8da | 37 | release_fiber(); |
JonnyA | 0:56b12ee8c8da | 38 | } |