Updated stepper motor controller

Fork of StepperController by Viorel Stefan Savinescu

Revision:
0:2cfd64d210f3
Child:
1:6e8186dd5bfa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/steppercontroller.h	Mon Jun 29 07:47:45 2015 +0000
@@ -0,0 +1,26 @@
+#ifndef STEPPERCONTROLLER_H
+#define STEPPERCONTROLLER_H
+#include "mbed.h"
+
+class StepperController {
+    
+public:
+    enum Direction {DirectionCW = 1, DirectionCCW = -1};
+    StepperController(PinName phaseA,PinName enA, PinName phaseB, PinName enB );
+    void advance();
+    void setPeriod(float period);
+    void setPulseWidth(float width);
+    void setDirection(Direction dir);
+    
+private:
+    int state;
+    float pulseWidth;
+    DigitalOut phaseA, phaseB;
+    PwmOut enA, enB;
+    Direction dir;
+    void updateOutputs();
+   
+   
+};
+    
+ #endif   
\ No newline at end of file