reads the sensor data

Dependencies:   MAG3110 MMA8451Q SLCD TSI mbed-src

Fork of KL46Z by JP PANG

Files at this revision

API Documentation at this revision

Comitter:
jppang
Date:
Fri Feb 07 14:24:49 2014 +0000
Parent:
0:52fadadad843
Child:
4:e3770fac7512
Commit message:
updated mbed lib, not work

Changed in this revision

FRDM_KL46Z_LCD.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FRDM_KL46Z_LCD.lib	Fri Feb 07 14:24:49 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/highroads/code/FRDM_KL46Z_LCD/#c5fea5b6b339
--- a/main.cpp	Mon Oct 14 14:57:22 2013 +0000
+++ b/main.cpp	Fri Feb 07 14:24:49 2014 +0000
@@ -1,59 +1,55 @@
-//KL46Z try out
 #include "mbed.h"
 #include "TSISensor.h"
 #include "MMA8451Q.h"
 #include "MAG3110.h"
+#include "vfnLCD.h"
 #include <cstdlib>
 #include <iostream>
 
 Serial pc(USBTX, USBRX);
 
 TSISensor tsi;
-MMA8451Q acc51(PTE25, PTE24, 0x1D<<1);
+MMA8451Q acc(PTE25, PTE24, 0x1D<<1);
 MAG3110 mag(PTE25, PTE24, 0x0E<<1);
+vfnLCD lcd;
 
 PwmOut rled(PTE29);
 PwmOut gled(PTD5);
 AnalogIn lightSensor(PTE22);
-DigitalIn SW1(PTC3);
-DigitalIn SW3(PTC12);
-//AnalogOut lcd03(PTB23);
-//PwmOut lcd07(PTB7);
+DigitalIn s1(PTC3);
+DigitalIn s3(PTC12);
 
 
 int main()
 {
     using namespace std;
-    
-    float onTime = 1.0;
-    float offTime = 0.0;
+
+  //  float onTime = 1.0;
+ //   float offTime = 0.0;
     float holdTime = 1.0;
-    bool on = true;
-    bool off = false;
     int magX = 0, magY = 0, magZ = 0;
-    //lcd03.write(0.33);
-    //lcd07.write(0.25);
-    //lcd07.period_ms(10);
-        
-    while(true) {
-                
-        rled = onTime - abs(acc51.getAccX());
-        gled = onTime - abs(acc51.getAccY());
+   
+
+    while(1) {
+
+        rled = abs(acc.getAccX());
+        //gled = abs(acc.getAccY());
         mag.getValues(&magX, &magY, &magZ);
-        
-        cout << "MMA8451: " << acc51.getAccX() << "\t" << acc51.getAccY() << "\t" << acc51.getAccZ() << "\n\r" << endl;
+        lcd.vfnLCD_All_Segments_ON();
+
+        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;
         wait(holdTime);
-        
+
         rled = tsi.readPercentage();
         gled = tsi.readPercentage();
-        
+        lcd.vfnLCD_All_Segments_OFF();
+
         cout << "Touch: " << tsi.readPercentage() << "\n\r" << endl;
-        cout << "SW1: " << SW1 << "\n\r" << endl;
-        cout << "SW3: " << SW3 << "\n\r" << endl;
+        cout << "SW1: " << s1 << "\n\r" << endl;
+        cout << "SW3: " << s3 << "\n\r" << endl;
         cout << "Light Sensor: " << lightSensor << "\n\r" << endl;
         wait(holdTime);
     }
-    return 0;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 07 14:24:49 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file
--- a/mbed.lib	Mon Oct 14 14:57:22 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/#a9913a65894f