Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:839533b03cb9, committed 2017-02-08
- 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 |
--- /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