Stepper dengan driver TB6600 Microstep Driver
Dependents: StepperTB_Example Lowlevel_function
Diff: StepperTB.h
- Revision:
- 0:7902453bcfef
- Child:
- 2:787cee5a8dad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StepperTB.h Wed Oct 24 16:15:53 2018 +0000 @@ -0,0 +1,47 @@ +#ifndef STEPPERTB_H +#define STEPPERTB_H + +#include "mbed.h" + +class StepperTB { + public: + /*Parameterized CTOR + *ENA = ENA- + *DIR = DIR- + *PUL = PUL- + *Microstep = jumlah microstep dalam 1 step + *StepPerRev = jumlah step dalam 1 putaran + */ + StepperTB(PinName ENA, PinName DIR, PinName PUL, int Microstep, int StepPerRev); + + /*Method*/ + /*MoveStep + *Gerakkan stepper sebanyak StepAmt step dengan + *Selang waktu antar microstep selama Interval (dalam us) + */ + void MoveStep(int StepAmt, int Interval); + + /*MoveRev + *Gerakkan stepper sejauh RevAmt putaran dengan + *Selang waktu antar microstep selama Interval (dalam us) + */ + void MoveRev(int RevAmt, int Interval); + + //Getter + //StepPerRev + int getSPR(); + //Microstep + int getMstep(); + + private: + //Pins + DigitalOut ENA_; + DigitalOut DIR_; + DigitalOut PUL_; + + int Microstep_; + int StepPerRev_; + +}; + +#endif