Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of StepperController by
steppercontroller.h
00001 #ifndef STEPPERCONTROLLER_H 00002 #define STEPPERCONTROLLER_H 00003 #include "mbed.h" 00004 00005 class StepperController { 00006 00007 public: 00008 enum Direction {DirectionCW = 1, DirectionCCW = -1}; 00009 enum SequenceType {Consecutive, Interleaved}; 00010 StepperController(PinName phaseA,PinName enA, PinName phaseB, PinName enB ); 00011 void advance(); 00012 void setPeriod(float period); 00013 void setPulseWidth(float width); 00014 void setDirection(Direction dir); 00015 void setSequenceType(SequenceType seq); 00016 00017 private: 00018 int state; 00019 float pulseWidth; 00020 DigitalOut phaseA, phaseB; 00021 PwmOut enA, enB; 00022 Direction dir; 00023 SequenceType seq; 00024 void updateOutputs(); 00025 00026 00027 }; 00028 00029 #endif
Generated on Thu Jul 14 2022 15:54:09 by
1.7.2
