Version 1

Revision:
3:69c670ed6382
Parent:
2:eff06aa2a885
Child:
4:bdd445879de2
diff -r eff06aa2a885 -r 69c670ed6382 main.cpp
--- a/main.cpp	Thu Mar 16 11:33:57 2017 +0000
+++ b/main.cpp	Thu Mar 16 11:39:12 2017 +0000
@@ -41,7 +41,7 @@
 
 volatile float revTime;
 volatile float revPerMin;
-volatile float freq;
+volatile float dutyCycle;
 
 //Status LED
 DigitalOut led1(LED1);
@@ -98,10 +98,10 @@
 }   
 
 void decrease(){
-    freq -= 0.05;
-    pc.printf("current value: %f", freq);
-    if (freq < 0.2){
-        freq = 1;
+    dutyCycle -= 0.05;
+    pc.printf("current value: %f", dutyCycle);
+    if (dutyCycle < 0.2){
+        dutyCycle = 1;
         }    
 }
         
@@ -159,7 +159,7 @@
     L2H.period(per);
     L3L.period(per);
     L3H.period(per);
-    freq = 1;
+    dutyCycle = 1;
     pc.printf("Device on \n\r");
     
     //Run the motor synchronisation
@@ -178,15 +178,15 @@
              char buffer[128];
         
                 pc.gets(buffer, 6);
-                freq = atof(buffer);
+                dutyCycle = atof(buffer);
                  pc.printf("I got '%s'\n\r", buffer); 
-                 pc.printf("Also in float '%f'\n\r", freq); 
+                 pc.printf("Also in float '%f'\n\r", dutyCycle); 
                  orState = motorHome();
             }
         
         if (intState != intStateOld) {
             intStateOld = intState;
-            motorOut((intState-orState+lead+6)%6, freq); //+6 to make sure the remainder is positive
+            motorOut((intState-orState+lead+6)%6, dutyCycle); //+6 to make sure the remainder is positive
         }
     }
 }