microbit digital read test based on Lancaster University runtime

Dependencies:   microbit

Fork of microbit-hello-world by BBC

Files at this revision

API Documentation at this revision

Comitter:
coocox_paul
Date:
Mon Sep 19 03:40:12 2016 +0000
Parent:
0:0041f35b0c4c
Commit message:
first commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0041f35b0c4c -r 2beebd57f1dc main.cpp
--- a/main.cpp	Wed Jul 13 16:03:21 2016 +0100
+++ b/main.cpp	Mon Sep 19 03:40:12 2016 +0000
@@ -29,11 +29,23 @@
 
 int main()
 {
+    int v;
     // Initialise the micro:bit runtime.
     uBit.init();
 
     // Insert your code here!
-    uBit.display.scroll("HELLO WORLD! :)");
+    uBit.display.scroll(":)");
+    
+    while(1) {
+        
+      v = uBit.io.P12.getDigitalValue();
+      if(v) {
+        uBit.display.scroll(":1");    
+      } else {
+        uBit.display.scroll(":0");    
+      }
+      uBit.sleep(2000);
+    }
 
     // If main exits, there may still be other fibers running or registered event handlers etc.
     // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then