Class ServoStepperPositionI2C - GSTCH/SketchMadeEASY GitHub Wiki

Actuator ServoStepperPositionI2C

Topic Specification
Description This class controls a position drive. It controls a stepper motor using Adafruit Motor Shield Version 2. This is able to control up to 2 stepper motors. It’s connected via I2C Bus. Up to 32 are stackable.
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 ServoStepperPositionI2C(int StepperNr, int Resolution, int GearRatio, int MinAngle, int MaxAngle, int RotationSpeed = 50, EInitializeMode InitializeMode = spNone, int HomeSwitchPin = 0, ESwitchResistoreMode HomeSwitchResistoreMode = smPullDownInternal, EStepStyle aStepStyle = ssSingle, int aBusAdddress = 0x60)
Parameter
StepperNr: stepper motor 1 or 2 of the shield
Resolution: Steps per revolution of the stepper motor (without gear)
GearRatio: Gear box ratio
MinAngle:Minimum angle of the servo
MaxAngle: Maximum angle of the servo
RotationSpeed: Speed of the motor [rotations per minute]. Optionally with value 50.
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)
    StepStyle: Type of stepper motor signal. Optionally with the value ssSingle. Possible values are:
  • ssSingle (=1)
  • ssDouble (=2)
  • ssInterleave (=3)
  • ssMicrostep (=4)
    BusAdddress: I2C Address of the shield. Optionally with the value 0x60. If several shields are stacked, the address must be changed (by soldering). If several shields are stacked, the address must be changed (by soldering).
  • Range MinAngle…MaxAngle
    Samples ServoStepperPositionI2C* stepper = new ServoStepperPositionI2C(2, 20, 71, -180, 180, 20);
    Examples 18 ‐ Stepper angle controlled by joystick
    ⚠️ **GitHub.com Fallback** ⚠️