for pressup

Dependencies:   FRDM_MMA8451Q mbed

Fork of mbed_Pedometer by Costa

Revision:
4:a8d5a55a89da
Parent:
2:b6569bd9af81
Child:
5:d497f1566d19
--- a/main.cpp	Thu Jun 16 15:25:11 2016 +0000
+++ b/main.cpp	Thu Jun 16 15:50:48 2016 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
-#include "MMA8451Q.h"
-//#include "TSISensor.h"
+#include "MMA8451Q.h"       //allow use of accelerometer
+
 #define DEBUG
 #define INFOMESSAGES
 #define WARNMESSAGES
@@ -75,7 +75,7 @@
 {
     char c;
 
-    int count = 0;
+
 
     led1 = !led1;
     if(bufferPnt==0) {
@@ -138,13 +138,12 @@
 int main()
 {
     MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
-    float touch;
+
     buffer=(char *)calloc(BUFF_SIZE,1);
     reset=0;
-    int counter=0;
     int zcount;
     int xcount;
-    zcount=0;
+    zcount=0;               // initial conditions of values
     xcount=0;
     float a;
     float b;
@@ -167,7 +166,7 @@
             bufferPnt=0;
             INFO("[%d],##%s##",state,buffer);
             switch (state) {
-                case 0: {
+                case 0: {                                           //sets up microcontroller as client
                     resp=OKResponse(buffer,"WIFI GOT IP");
                     if (resp!=NULL) {
                         wait(1);
@@ -282,10 +281,10 @@
                                     INFO("SENDING");
 
                                     wait(0.2);
-                                    dev.printf("PEDOMETER");
+                                    dev.printf("PEDOMETER");        //send greeting to server
 
                     while (true) {
-                        z = (acc.getAccX());
+                        z = (acc.getAccX());  //changes it from measureing Z driection for press ups to X for running
                         x = (acc.getAccZ());
 
                         if (a==1.0) {
@@ -320,7 +319,7 @@
 
                         }
                         if (z>0) {
-                            a=1.0;
+                            a=1.0;      //prevents multiple signals for singal dip below zero
                         }
                     }
                     if (a==0) {