send microbit compass data
Diff: main.cpp
- Revision:
- 0:839533b03cb9
--- /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(); +} +