Class library for a Stepper Motor to be able to Select amount of steps,set the time interval between steps, run stepper motor freely and stop the stepper motor.

Files at this revision

API Documentation at this revision

Comitter:
Armand
Date:
Thu Mar 09 06:22:37 2017 +0000
Parent:
1:ceb6e16ceeff
Child:
3:82951e628d6a
Commit message:
Changed direction parameter from integer to Boolean.

Changed in this revision

Stepper.cpp Show annotated file Show diff for this revision Revisions of this file
Stepper.h Show annotated file Show diff for this revision Revisions of this file
--- a/Stepper.cpp	Fri Mar 03 10:30:05 2017 +0000
+++ b/Stepper.cpp	Thu Mar 09 06:22:37 2017 +0000
@@ -39,13 +39,13 @@
     
 }
 
-void Stepper::Direction(int dir) 
+void Stepper::Direction(bool dir) 
 {   
-    if(dir == 1)
+    if(dir == true)
     {
         StepDir = 1;
     }
-    else if(dir == -1)
+    else if(dir == false)
     {
         StepDir = -1;  
     }
--- a/Stepper.h	Fri Mar 03 10:30:05 2017 +0000
+++ b/Stepper.h	Thu Mar 09 06:22:37 2017 +0000
@@ -42,10 +42,10 @@
  *    while(1)                                               //Enter infinite while loop
  *    {
  *       stepper.Interval(0.1);                              //Choosing time interval between steps(control speed)
- *       stepper.Direction(1);                               //Choosing direction. 1 = Clockwise, -1 = Anticlockwise
+ *       stepper.Direction(true);                            //Choosing direction. true = Clockwise, false = Anticlockwise
  *       stepper.Run();                                      //Makes the stepper run continuously
- *       wait(5);                                            //mbeds wait function
- *       stepper.Direction(-1); 
+ *       wait(5);                                            //mbed's wait function, wait 5 sec.
+ *       stepper.Direction(false); 
  *       wait(5);   
  *       stepper.Stop();                                     //To make stepper stop
  *       wait(5);     
@@ -78,9 +78,9 @@
     
      /** Setting direction of the stepper motor, Clockwise or Anticlockwise.
     * @param 
-    *     Intiger to select direction. 1 = Clockwise, -1 = Anticlockwise
+    *     boolean slection to select direction. true = Clockwise, false = Anticlockwise
     */
-    void Direction(int dir);
+    void Direction(bool dir);
     
      /** Choosing time interval between steps(control speed).
     * @param