Alle subfiles samengevoegd

Dependencies:   HIDScope biquadFilter mbed MODSERIAL FastPWM QEI

Revision:
11:417193f23342
Parent:
10:4bd8ec9e79ff
Child:
12:9b0451105991
--- a/main.cpp	Mon Oct 31 12:44:23 2016 +0000
+++ b/main.cpp	Mon Oct 31 12:47:04 2016 +0000
@@ -112,6 +112,16 @@
 volatile int i = 0;
 volatile bool Stepper_CCW = false;
 
+// Setup stepper motor pins
+// DigitalOut pinMode(PTD2); //D11 NOW USES 3.3V OUPUT, SINCE THIS IS ALWAYS ON
+DigitalOut pinSleep(PTE24);      //D14
+DigitalOut pinStep(PTC4);        //D9
+DigitalOut pinDir(PTC12);        //D8
+
+// Control of the stepper motor with 1 Ticker and 1 Timeout
+Ticker  TickerStepper;
+Timeout TimeoutStepper;
+
 // Global variable Step_State
 volatile bool Stepper_State = false;        // false = we zijn niet bezig met flippen
 
@@ -179,8 +189,8 @@
     pinDir = false;
     // Calc the speed of the stepper
     int nPPS = 50*stepmode;  // was 1200, this controlls the speed, keep this times the step mode
-    float fFrequency_Hz = 1.f * nPPS;
-    float fPeriod_s = 1.0f / fFrequency_Hz;
+    double fFrequency_Hz = 1.f * nPPS;
+    double fPeriod_s = 1.0f / fFrequency_Hz;
     // Check if the speed is too fast small and report back if that is the case
     if (fPeriod_s < 2e-6)
     {
@@ -290,8 +300,7 @@
     double Step = Speed/CALC_F ;  //10 mm per seconde afleggen
     
     if (BicepsLeft==true && BicepsRight==true && Leg==true && Stepper_State==false) {   
-        Stepper_State = true;     // we zijn aan het flipper dus geen andere dingen doen
-        //FunctieFlipper() ;
+        Stepper_On();
     }
     else if (BicepsLeft==true && BicepsRight==false && Leg==false && Stepper_State==false) {
         x = x - Step;