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