Dorian Folie / Mbed 2 deprecated ACC_LCD_341_Basic_AXIS_DF

Dependencies:   MMA8451Q SLCD_minus_mod mbed

Fork of ACC_LCD_341_Basic by Stanley Cohen

Files at this revision

API Documentation at this revision

Comitter:
dorian505
Date:
Mon Nov 28 00:23:12 2016 +0000
Parent:
7:ae5c27eb1492
Child:
9:b2768bb45a68
Commit message:
v

Changed in this revision

acc_341.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/acc_341.cpp	Mon Nov 21 01:09:16 2016 +0000
+++ b/acc_341.cpp	Mon Nov 28 00:23:12 2016 +0000
@@ -16,7 +16,7 @@
 #define xAxis 0
 #define yAxis 1
 #define zAxis 2
-#define DigitalIn button(LBUT)
+
 #define PROGNAME "ACCLCD341-541\r\n"
 
 #define PRINTDBUG
@@ -39,7 +39,7 @@
 MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
 Serial pc(USBTX, USBRX);
 Timer dataTimer;
-
+DigitalIn button(LBUT)
    
 
 void LCDMess(char *lMess){
@@ -72,8 +72,11 @@
 // main loop forever 
   //Get accelerometer data - tilt angles minus offset for zero mark.
         while (true) {
-            for (int i=0; i < digitalIn; i++){ // index will be 0 or 1 
-                if(!digitalIn) { // a buttton is pressed
+        if (ButtonTimer > BUTTONTIME){
+            buttonValue = !buttons[1].read();
+            for (int i=0; i < NUMBUTS; i++){ // index will be 0 or 1 
+                if(!buttons[i]) {
+                    
                     //xAcc = acc.getAccX();
                     //yAcc = acc.getAccY(); 
                     //zAcc = acc.getAccZ();
@@ -95,10 +98,10 @@
                  // if ! buttons   
  
 #ifdef PRINTDBUG
-        pc.printf("xAcc = %f\r\n", xAcc);
-        pc.printf("yAcc = %f\r\n", yAcc);
-        pc.printf("zAcc = %f\r\n", zAcc);
-        pc.printf("LBUT = %f\r\n", LBUT);
+       // pc.printf("xAcc = %f\r\n", xAcc);
+        //pc.printf("yAcc = %f\r\n", yAcc);
+        //pc.printf("zAcc = %f\r\n", zAcc);
+        //pc.printf("LBUT = %f\r\n", LBUT);
 #endif
 
 // Wait then do the whole thing again.