-
Notifications
You must be signed in to change notification settings - Fork 0
Class Switch2Position
Hans Rothenbuehler edited this page Oct 27, 2024
·
16 revisions
| Topic | Specification |
|---|---|
| Description | Switch with two position (e.g. On/Off-Switch). Use one 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 3 position (e.g. Forward/Off/Backward) see class Switch3Positon |
| Constructor |
Switch2Position (int Pin, ESwitchResistoreMode SwitchResistoreMode, int DebounceTime) Parameter Pin: Pin numberSwitchResistoreMode: Optional with default smPullDownInternal (0). Details read Switch-Resistore-Mode. Possible values are: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 (Open), 1 (Close) |
| Const |
0: Switch2Position::Off, Switch2Position::Pos01: Switch2Position::On, Switch2Position::Pos1 |
| Samples | Switch2Position* switch = new Switch2Position(4); Switch2Position* switch = new Switch2Position(4, smPullDownExternal); Switch2Position* switch = new Switch2Position(4, smPullUpExternal, 60); |
| Examples |
01-Switch and Lamp 03-Dimming LED with Switch 07‐Motor variable speed, direction‐ and main‐switch 09‐Motor toggles between limit switches, main switch 10‐Main Motor turns between limit switches, second follows 11-Two motors, one turns after the other |
Wiki
Getting started
Classes
Input
- Calculate
- ConditionInput
- DependentInput
- DigitalInput
- FixValue
- Inverter
- IteratorValue
- JoystickAxis
- LoopSwitch
- MonoFlop
- Switch2Position
- Switch3Position
- Timer
- ToggleSwitch
- UltrasonicRangefinder
- VariableInput
Actuator
- ActuatorCollection
- Buzzer
- DigitalOutput
- EncoderMotorI2C
- EncoderMotorL298
- EncoderMotorL9110
- MotorI2C
- MotorL298
- MotorL9110
- MotorStepperRotate
- MotorStepperRotateI2C
- Servo360I2C
- Servo360PWM
- Servo360T1
- Servo360T2
- ServoPWM
- ServoStepperPosition
- ServoStepperPositionI2C
- ServoI2C
- ServoT1
- ServoT2
- VariableOutput
Condition
Relation
RemoteControl
Common
Sketches
Templates
Examples
- 01-Switch and Lamp
- 02-Dimming LED
- 03-Dimming LED with Switch
- 04-Blinking LED
- 05‐Motor fix speed, direction‐switch
- 06‐Motor variable speed, direction‐switch
- 07‐Motor variable speed, direction‐ and main‐switch
- 08‐Motor toggles between limit switches
- 09‐Motor toggles between limit switches, main switch
- 10‐Main Motor turns between limit switches, second follows
- 11-Two motors, one turns after the other
- 12-Servo360 controlled by a Joystick
- 13-Stepper motor with variable speed
- 14-RemoteControl of a motor with FlySky FS-i6X
- 15-RemoteControl of a motor with an App
- 16-EncoderMotor and LED controlled by FlySky-RemoteControl
- 17-Servo position in relation to a potentiometer
- 18-Stepper angle controlled by joystick
- 19-Buzzer tone in relation to distance
- 20-Dependent input
- 21-Alternate blink