OhmBoyZ_Capstone / Mbed 2 deprecated MagneticRead Featured

Dependencies:   mbed

/media/uploads/Krabby127/ohmboyzvectorized.png

Repository for the 2015 OhmBoyZ Capstone group.

Files at this revision

API Documentation at this revision

Comitter:
Krabby127
Date:
Tue Nov 17 17:19:01 2015 +0000
Child:
1:d901038c4bd2
Commit message:
Created copy to use

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld 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	Tue Nov 17 17:19:01 2015 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include <math.h>
+ 
+AnalogIn analog_value(A0);
+ 
+DigitalOut led(LED1);
+
+int main() {
+    float meas;
+    float b;
+    float offset;
+    printf("\nAnalogIn example\n");
+    while(1) {
+        meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        meas = meas * 3300; // Change the value to be in the 0 to 3300 range (currently to mV)
+        b=meas/(4.0*12.2*100.0); // Based 9h 
+        printf("meas = %fmV\n\r",meas);
+        printf("b = %f Gauss\n\r",b);
+        printf("B = %fuT\n\r", b*100.0); // Output B field in micro-Tesla
+        if (meas > 2000) { // If the value is greater than 2V then switch the LED on (greater than 
+          led = 1;
+        }
+        else {
+          led = 0;
+        }
+        wait(1.0); // 1 s
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 17 17:19:01 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file