An example of how to us the micro:bit DAL's abstraction. This is a one-way translation of the microbit-samples repository on GitHub. Please don't try to push changes here, instead push them to the source repo at https://github.com/lancaster-university/microbit-samples

Dependencies:   microbit

Fork of microbit-hello-world by micro:bit

Committer:
LancasterUniversity
Date:
Wed Jul 13 16:03:21 2016 +0100
Revision:
0:0041f35b0c4c
Update to git: v2.0.0-rc4-5-g115d5a8

Who changed what in which revision?

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