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.
Dependencies: mbed
Repository for the 2015 OhmBoyZ Capstone group.
Revision 12:b9d71de8733d, committed 2015-12-08
- Comitter:
- Krabby127
- Date:
- Tue Dec 08 02:10:55 2015 +0000
- Parent:
- 11:791839389530
- Child:
- 13:51e3bfd1f6c0
- Commit message:
- Updated for readability and equation corrections
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 01 19:25:17 2015 +0000 +++ b/main.cpp Tue Dec 08 02:10:55 2015 +0000 @@ -8,20 +8,20 @@ int main() { float meas; float b; - printf("\nAnalogIn example\n"); + printf("\n\rAnalogIn example\n\r"); 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) - printf("meas = %fmV\n\r",meas); // Print out raw measurement in terms of mV - b=(((meas-(3.3/2.0*1000))/1000)/(4.0*12.2*100.0)); // Based on equation 1 from DRV425EVM pdf - //VVOUT [V] = B × G × RSHUNT × GAMP = B [mT] × 12.2 mA/mT × RSHUNT [Ω] × 4 [V/V] + meas = meas * 3.3; // Change the value to be in the 0 to 3.3 range (currently to mV) + printf("meas = %fmV\n\r",meas*1000); // Print out raw measurement in terms of mV + b=(meas-(3.3/2.0))/(4.0*12.2*100.0); // Based on equation 1 from DRV425EVM pdf + //VVOUT [V] = B × G × RSHUNT × GAMP = B [uT] × 12.2 mA/mT × RSHUNT [Ω] × 4 [V/V] //VVOUT is with reference to REFIN - //0 Tesla is VDD/2 + // 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*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] + printf("b = %fuT\n\r",b); // Print out b field measure in micro-Tesla + printf("b = %fuT\n\r", b/100.0); // Output B field in Gauss + if (meas > 1.65) { // If the value is greater than 1.65V then switch the LED on + // positive magnetic field led = 1; } else {