send microbit compass data

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
kinga
Date:
Wed Feb 08 14:33:59 2017 +0000
Commit message:
Microbit - sending compass data

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
microbit.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 839533b03cb9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 08 14:33:59 2017 +0000
@@ -0,0 +1,25 @@
+#include "MicroBit.h"
+
+MicroBit uBit;
+MicroBitSerial serial(USBTX, USBRX);
+MicroBitI2C i2c(I2C_SDA0, I2C_SCL0); 
+
+MicroBitAccelerometer accelerometer(i2c); 
+
+MicroBitStorage storage; 
+
+MicroBitCompass compass(i2c, accelerometer, storage); 
+
+int main()
+{
+    uBit.init();
+
+    while (1) {
+      int heading = compass.heading();
+      serial.send((ManagedString)heading);
+      uBit.sleep(500);
+    }
+    
+    release_fiber();
+}
+
diff -r 000000000000 -r 839533b03cb9 microbit.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/microbit.lib	Wed Feb 08 14:33:59 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f