tried out the sensor board by mbed
Dependencies: MAG3110 MMA8451Q MMA8491Q MPL3115A2 TSI TextLCD mbed
Revision 1:561b57bbbdcc, committed 2013-10-10
- Comitter:
- jppang
- Date:
- Thu Oct 10 02:48:03 2013 +0000
- Parent:
- 0:3add2fd1bf66
- Child:
- 2:1b93ae1eac4b
- Commit message:
- modified MPL3115A2
Changed in this revision
MPL3115A2.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MPL3115A2.lib Thu Oct 10 02:23:00 2013 +0000 +++ b/MPL3115A2.lib Thu Oct 10 02:48:03 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/clemente/code/MPL3115A2/#98b64b8fe817 +http://mbed.org/users/jppang/code/MPL3115A2/#98b64b8fe817
--- a/main.cpp Thu Oct 10 02:23:00 2013 +0000 +++ b/main.cpp Thu Oct 10 02:48:03 2013 +0000 @@ -45,29 +45,36 @@ bool on = true; bool off = false; int magX = 0, magY = 0, magZ = 0; + float mplAlt = .0, mplPres = .0, mplTemp = .0; mpl.Altimeter_Mode(); while(true) { enMMA8491 = on; + rled = onTime - abs(acc51.getAccX()); gled = onTime - abs(acc51.getAccY()); bled = onTime - abs(acc51.getAccZ()); mag.getValues(&magX, &magY, &magZ); + mplAlt = mpl.getAltimeter(); + mplTemp = mpl.getTemperature(); cout << "MMA8451: " << acc51.getAccX() << "\t" << acc51.getAccY() << "\t" << acc51.getAccZ() << "\n\r" << endl; cout << "MMA8491: " << acc91X << "\t" << acc91Y << "\t" << acc91Z << "\n\r" << endl; cout << "MMA8491: " << acc91.getAccX() << "\t" << acc91.getAccY() << "\t" << acc91.getAccZ() << "\n\r" << endl; cout << "MAG3110: " << magX << "\t" << magY << "\t" << magZ << "\n\r" << endl; + mpl.Barometric_Mode(); wait(holdTime); enMMA8491 = off; - cout << mpl.getStatus() << "\n\r" << endl; + rled = onTime - tsi.readPercentage(); gled = onTime - tsi.readPercentage(); bled = onTime - tsi.readPercentage(); + mplPres = mpl.getPressure(); cout << "Touch: " << tsi.readPercentage() << "\n\r" << endl; - cout << "MPL3115: " << mpl.getAltimeter() << "\t" << mpl.getPressure() << "\t" << mpl.getTemperature() << "\n\r" << endl; + cout << "MPL3115: " << mplAlt << "\t" << mplPres << "\t" << mplTemp << "\n\r" << endl; + mpl.Altimeter_Mode(); wait(holdTime); } return 0;