Class ServoStepperPosition - GSTCH/SketchMadeEASY GitHub Wiki

Actuator ServoStepperPosition

Topic Specification
Description This class controls a position drive. It controls a stepper motor using AccelStepper library.
Sketch Made EASY includes an auto map from input to actuator. The class map the range of the assigned input (via relation) to an angle.
Constructor ServoStepperPosition(int Pin1, int Pin2, int Pin3, int Pin4, int RotationSpeed, int MinAngle, int MaxAngle, int Resolution, int GearRatio, EInitializeMode InitializeMode = spNone, int HomeSwitchPin = 0, ESwitchResistoreMode HomeSwitchResistoreMode = smPullDownInternal, EMotorInterfaceType MotorInterfaceType = miFull4Wire)
Parameter
Pin1:Digital pin connected with motor shield
Pin2:Digital pin connected with motor shield
Pin3:Digital pin connected with motor shield
Pin4:Digital pin connected with motor shield
RotationSpeed: Speed of the motor [rotations per minute].
MinAngle:Minimum angle of the servo
MaxAngle: Maximum angle of the servo
Resolution: Steps per revolution of the stepper motor (without gear)
GearRatio: Gear box ratio
InitializeMode: With a limit switch the stepper is able to start from a defined position. Optionally with value spNone. Multiple modes are possible:
  • spNone (=0): Start at current position
  • spForward (=1): Begin forward to limit switch
  • spBackward (=2): Begin backward to limit switch
    HomeSwitchPin: Digital pin with limit switch to detect 0-position. Optionally with the value 0
    SwitchResistoreMode: Optional with default smPullDownInternal. Details read Switch-Resistore-Mode. Possible values are:
  • smPullDownInternal (=0)
  • smPullDownExternal (=1)
  • smPullUpExternal (=2)
    EMotorInterfaceType MotorInterfaceType: Read AccelStepper documentation to get more informations. Optionally with value miFull4Wire. Possible values are:
  • miFunction (=0)
  • miDriver (=1)
  • miFull2Wire (=2)
  • miFull3Wire (=3)
  • miFull4Wire (=4)
  • miHalf3Wire (=6) - Turns only the half angle!
  • miHalf4Wire (=8) - Turns only the half angle!
  • Range MinAngle…MaxAngle
    Samples ServoStepperPosition* stepper = new ServoStepperPosition(8, 10, 9, 11, 5, 0, 360, 32, 64, spNone, 0, spBackward, miFull4Wire);
    Examples Look test "55-ServoStepperPosition"
    ⚠️ **GitHub.com Fallback** ⚠️