should work with the data logger app to measure temperature, etc.

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
kinga
Date:
Thu Jan 19 10:14:02 2017 +0000
Commit message:
data_logger version 2

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 9ac8338343fb main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 19 10:14:02 2017 +0000
@@ -0,0 +1,41 @@
+/* See
+ * http://lancaster-university.github.io/microbit-docs/advanced/
+ * for docs about using the micro:bit library
+*/
+#include "MicroBit.h"
+
+MicroBit uBit;
+
+void onConnected(MicroBitEvent)
+{
+    uBit.display.print("C");
+}
+
+void onDisconnected(MicroBitEvent)
+{
+    uBit.display.print("D");
+}
+
+int main()
+{
+    // Initialise the micro:bit runtime.
+    uBit.init();
+    // Display a start-up message
+    uBit.display.scroll("GREEN FOX");
+
+    // Application code will go here and in functions outside of main()
+
+    uBit.messageBus.listen(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_CONNECTED, onConnected);
+    uBit.messageBus.listen(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED, onDisconnected);
+
+    new MicroBitAccelerometerService(*uBit.ble, uBit.accelerometer);
+    new MicroBitMagnetometerService(*uBit.ble, uBit.compass);
+    new MicroBitTemperatureService(*uBit.ble, uBit.thermometer);
+
+    // end of application code in main()
+
+    // 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
+    // sit in the idle task forever, in a power efficient sleep.
+    release_fiber();
+}
\ No newline at end of file
diff -r 000000000000 -r 9ac8338343fb microbit.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/microbit.lib	Thu Jan 19 10:14:02 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f