speed increment for loop

Dependencies:   Encoder HIDScope MODSERIAL mbed

Files at this revision

API Documentation at this revision

Comitter:
Vigilance88
Date:
Wed Sep 23 09:22:40 2015 +0000
Parent:
2:c8a030f3b4e7
Commit message:
speed increment loop test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c8a030f3b4e7 -r e333b4258af4 main.cpp
--- a/main.cpp	Wed Sep 23 09:10:48 2015 +0000
+++ b/main.cpp	Wed Sep 23 09:22:40 2015 +0000
@@ -24,12 +24,12 @@
 
     while (1) {
     
-        pwm_motor2.period(0.0001);
-        for (float s= 0.0f; s <= 1.1f ; s += 0.01f) {
-            dir_motor2=1;
-            pwm_motor2.write(s);
-            wait(0.1);
-            pc.printf("pwm duty: %f, %d, \n\r", s, motor2.getPosition());
+        pwm_motor2.period(0.0001);   //100us period
+        for (float s= 0.0f; s <= 1.1f ; s += 0.01f) {       //increase pwm from 0 to 1, steps of 0.1
+            dir_motor2=1;                                   //direction
+            pwm_motor2.write(s);                            //write pwm value s to motor
+            wait(0.1);                                      
+            pc.printf("pwm duty: %f, %d, \n\r", s, motor2.getPosition());       //print values to putty
         }
     }
 }
\ No newline at end of file