Codice per pilotare il motore IHM01A1

Dependencies:   mbed X_NUCLEO_IHM01A1

Revision:
2:e12e4df7a486
Parent:
1:fbf28f3367aa
Child:
3:fffa53c7aed2
--- a/main.cpp	Fri Oct 16 13:51:31 2015 +0000
+++ b/main.cpp	Fri Nov 13 12:59:29 2015 +0000
@@ -87,7 +87,7 @@
         printf("--> Moving forward %d steps.\r\n", ROUND_ANGLE_STEPS);
 
         /* Moving N steps in the forward direction. */
-        motor->Move(FORWARD, ROUND_ANGLE_STEPS);
+        motor->Move(StepperMotor::CW, ROUND_ANGLE_STEPS);
         
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();
@@ -108,7 +108,7 @@
         printf("--> Moving backward %d steps.\r\n", ROUND_ANGLE_STEPS);
         
         /* Moving N steps in the backward direction. */
-        motor->Move(BACKWARD, ROUND_ANGLE_STEPS);
+        motor->Move(StepperMotor::CCW, ROUND_ANGLE_STEPS);
         
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();
@@ -174,13 +174,13 @@
         printf("--> Moving backward.\r\n");
 
         /* Requesting to run backward. */
-        motor->Run(BACKWARD);
+        motor->Run(StepperMotor::CCW);
 
         /* Waiting until delay has expired. */
         wait_ms(6000);
 
         /* Getting current speed. */
-        int speed = motor->GetCurrentSpeed();
+        int speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -198,7 +198,7 @@
         wait_ms(6000);
 
         /* Getting current speed. */
-        speed = motor->GetCurrentSpeed();
+        speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -216,7 +216,7 @@
         wait_ms(8000);
 
         /* Getting current speed. */
-        speed = motor->GetCurrentSpeed();
+        speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -228,7 +228,7 @@
         printf("--> Moving forward.\r\n");
 
         /* Requesting to run in forward direction. */
-        motor->Run(FORWARD);
+        motor->Run(StepperMotor::CW);
 
         /* Waiting until delay has expired. */
         wait_ms(4000);