FRDM-KL46Z pinmap is different from KL25Z
Dependencies: MAG3110 MMA8451Q TSI SLCD mbed-src
Diff: main.cpp
- Revision:
- 3:6b371e451f9e
- Parent:
- 2:e3770fac7512
diff -r e3770fac7512 -r 6b371e451f9e main.cpp --- a/main.cpp Sun Feb 09 12:29:43 2014 +0000 +++ b/main.cpp Tue Feb 11 09:08:57 2014 +0000 @@ -2,14 +2,17 @@ #include "TSISensor.h" #include "MMA8451Q.h" #include "MAG3110.h" +#include "SLCD.h" #include <cstdlib> #include <iostream> +#include <cstring> Serial pc(USBTX, USBRX); TSISensor tsi; MMA8451Q acc(PTE25, PTE24, 0x1D<<1); MAG3110 mag(PTE25, PTE24, 0x0E<<1); +SLCD lcd; PwmOut rled(PTE29); PwmOut gled(PTD5); @@ -25,7 +28,8 @@ float onTime = 1.0; // float offTime = 0.0; float holdTime = 1.0; - int magX = 0, magY = 0, magZ = 0; + int magX = 0, magY = 0, magZ = 0; + char lcdMessage[40]; while(1) { @@ -36,6 +40,9 @@ cout << "MMA8451: " << acc.getAccX() << "\t" << acc.getAccY() << "\t" << acc.getAccZ() << "\n\r" << endl; cout << "MAG3110: " << magX << "\t" << magY << "\t" << magZ << "\n\r" << endl; cout << "MAG3110: " << mag.getHeading() << "\n\r" << endl; + //lcd.All_Segments(1); + sprintf(lcdMessage, "%4.0f", mag.getHeading()); + lcd.printf(lcdMessage); wait(holdTime); rled = tsi.readPercentage(); @@ -45,6 +52,8 @@ cout << "SW1: " << s1 << "\n\r" << endl; cout << "SW3: " << s3 << "\n\r" << endl; cout << "Light Sensor: " << lightSensor << "\n\r" << endl; + //lcd.All_Segments(0); + lcd.printf(lcdMessage); wait(holdTime); } }