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 Dec 01 16:38:24 2015 +0000
Parent:
5:760f85b3f309
Child:
9:4b887a45ac8c
Commit message:
Fixed equation 1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Nov 25 02:28:53 2015 +0000
+++ b/main.cpp	Tue Dec 01 16:38:24 2015 +0000
@@ -13,12 +13,12 @@
         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)
         printf("meas = %fmV\n\r",meas); // Print out raw measurement in terms of mV
-        b=((meas/1000)/(4.0*12.2*100.0))-3.3/2.0; // Based on equation 1
+        b=((meas-3.3/2.0/1000)/(4.0*12.2*100.0)); // Based on equation 1
         //VVOUT [V] = B × G × RSHUNT × GAMP = B [mT] × 12.2 mA/mT × RSHUNT [Ω] × 4 [V/V]
         //0 Tesla is VDD/2
         // 12.2 mA/mT
         printf("b = %f Gauss\n\r",b); // Print out b field measure in milliTesla
-        printf("B = %fuT\n\r", b*1000.0); // Output B field in micro-Tesla
+        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 410 microGauss [40 mT]
           led = 1;