ES305H Lanier Turchan / Mbed 2 deprecated Turret_move

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
m166588
Date:
Tue Mar 03 14:25:05 2015 +0000
Parent:
2:1ef6c6f5dfe1
Commit message:
920 with saturation

Changed in this revision

Turret_move.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Turret_move.cpp	Tue Mar 03 14:19:47 2015 +0000
+++ b/Turret_move.cpp	Tue Mar 03 14:25:05 2015 +0000
@@ -14,6 +14,14 @@
     printf("Enter duty cycle, 0 to 100:\n"); 
     scanf("%d", &input_dc); 
     duty_cycle = input_dc/100.0;  
+    if (duty_cycle >=1.0)
+    {
+        duty_cycle = 1.0; 
+    }
+    if (duty_cycle <= 0.0)
+    {
+        duty_cycle = 0.0;
+    }
     
     printf("%f duty cycle set. Enter 0 for CCW or 1 for CW spin direction:\n",duty_cycle); 
     scanf("%d", &user_direction);