Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   mbed Queue mbed-rtos FXOS8700Q

Fork of Pacemaker by Eric dollar

SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.

The project uses the Freescale K64F Microcontroller and C++ mbed library.

Revision:
36:b6431cd8ecd6
Parent:
33:686a1a0c690f
diff -r fa164704f0ca -r b6431cd8ecd6 motion.cpp
--- a/motion.cpp	Tue Dec 13 04:34:36 2016 +0000
+++ b/motion.cpp	Sun Dec 18 02:29:59 2016 +0000
@@ -12,6 +12,7 @@
 
 /* Constants and Declares */
 int numCount;
+int numCount2;
 chamberData* ventChamber;
 chamberData* atrChamber;
 int const MAX_NUM_COUNTS = 3;
@@ -52,24 +53,26 @@
 
     if (numCount >= MAX_NUM_COUNTS) {
         ventChamber->chngPaceWidth(ventChamber->getPaceWidth() - 0.01);
-        //red = !red;   // toggle LEDs to show acceleration threshold reached
+        numCount = 0;
+ //       red = !red;   // toggle LEDs to show acceleration threshold reached
         
         motion_exceeded_threshold = 1;
     }
 }
 
 void b_count(){
-    numCount++;
+    numCount2++;
     
-    if (numCount >= MIN_NUM_COUNTS){
+    if (numCount2 >= MIN_NUM_COUNTS){
         ventChamber->chngPaceWidth(ventChamber->getPaceWidth() + 0.01);
-        //red = !red;
+        numCount2 = 0;
+  //      red = !red;
     }
 }
 
 void motion_thread () {
     while(true) {
-
+  //      red = !red;
         float xAcc, yAcc, zAcc;
         acc.getX(&xAcc);
         acc.getY(&yAcc);
@@ -80,7 +83,7 @@
             a_count();      // increment acceleration event counter
         }
 
-        if (magtd < 1.0f){
+        if (magtd < 1.5f){
             b_count();
         Thread::wait(TIMING_PERIOD); 
         }