Class Switch3Position - GSTCH/SketchMadeEASY GitHub Wiki

Input Switch3Position

Topic Specification
Description Switch with three position (e.g. Forward/Off/Backward-Switch).
Use two diginal input pin, set in the constructor. Optional is a debounce time (duration to ignore any changes after LOW/HIGH or HIGH/LOW change).
This classes support the SwitchResistoreMode, set in the constructor. Default is internal pullup.
For switch with 2 position (e.g. On/Off) see class Switch2Positon
Constructor Switch3Position (int Position1Pin, int Position2Pin, ESwitchResistoreMode SwitchResistoreMode, int DebounceTime)
Parameter
Position1Pin: Pin number of position 1
Position2Pin: Pin number of position 2
SwitchResistoreMode: Optional with default smPullDownInternal (0). Details read Switch-Resistore-Mode. Possible values are:
  • smPullDownInternal (=0)
  • smPullDownExternal (=1)
  • smPullUpExternal (=2)
    Sketch Made Easy hides the different values of the pin and always has the same value
    DebounceTime: Optional with Default=50ms. The interval that must pass before a value changed is accepted. Value in Milliseconds.
  • Range 0 (Pos0), 1 (Pos1), 2 (Pos2)
    Const 0: Switch3Position::Pos0, Switch3Position::Off, Switch3Position::Mid
    1: Switch3Position::Pos1
    2: Switch3Position::Pos2
    Samples Switch3Position* switch = new Switch3Position(4, 6);
    Switch3Position* switch = new Switch3Position(4, 6, smPullDownExternal);
    Switch3Position* switch = new Switch3Position(4, 6, smPullUpExternal, 60);
    Examples 05‐Motor fix speed, direction‐switch
    06‐Motor variable speed, direction‐switch
    07‐Motor variable speed, direction‐ and main‐switch
    13-Stepper motor with variable speed
    20-Dependent input
    ⚠️ **GitHub.com Fallback** ⚠️