send microbit compass and accelerometer data

Dependencies:   microbit

Fork of compass_data_sender by Kinga Magyar

Files at this revision

API Documentation at this revision

Comitter:
kinga
Date:
Wed Feb 08 14:33:59 2017 +0000
Child:
1:d034c78be66a
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
--- /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();
+}
+
--- /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