Menu

StepperSingle

Perrotti

Class StepperSingle

This is the only class outside the stepper hierarchy, it is made to control a single stepper motor. The other classes are made to control a pair of motors in differential configuration.

  • File: pStpMotor.h
  • Dependences: pGlobals.h
  • See too: [StepperMotors]
  • Wiki em português:

Public declaration:

#define SM_BRAKE_CUT_PERCENT     65

enum TStepDirection { stpDir_Back= -1,  stpDir_Stay= 0, stpDir_Ahead= 1};

class StpSingleOwner{
public:
  virtual void onMoveDone(byte motorID, long steps){}
  virtual void onStepsDone(byte motorID, long steps, long totalSteps){}
};

class StepperSingle{
public:
  // Construction
  StepperControl();
  StepperControl(byte motorID, StpSingleOwner* owner);

  // Initialization
  void begin(uint startSpeed, uint cruiseSpeed);
  void beginPins(int mPin1, int mPin2, int mPin3, int mPin4);
  void setBrakeCutPercent(byte brakeCutPercent);
  void turboOn();
  void turboOff();
  void halfStepOn();
  void halfStepOff();
  void setReportSteps(long steps);
  void enableAutoRun();

  // Operation
  void run();
  void moveSteps(TStepDirection direction, long steps, boolean oddOnly= false);
  void moveOn(TStepDirection direction, boolean oddOnly= false);
  void stopNow();
  void decelStop();
  void motorOff();

  // Monitoring
  boolean halfStep();
  boolean isMoving();
};

Related

Wiki: StepperCouple
Wiki: StepperDuo
Wiki: StepperMotors
Wiki: StpDuoBuff
Wiki: StpDuoTimer2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.