|MotorControllerSetter (Setter *targetA, Setter *targetB)|
|void||setTargets (Setter *targetA, Setter *targetB)|
|virtual void||input (int value)|
|virtual void||failsafe ()|
|Public Member Functions inherited from Setter|
|Setter (Setter *target)|
|Constructor with setting the target. |
|virtual void||setTarget (Setter *target)|
|void||setFailsafeValue (int failsafeValue)|
|Sets the failsafeValue. |
|Protected Attributes inherited from Setter|
|This is the instance of Setter that will be given the transfotmed output value. |
Setter class that outputs its value to a MotorController configured on 1 digital and one analog output pins.
A MotorController is used to drive a motor in forward and reverse directions. It requires 2 Setters as output: one to specify the direction, and one to specify the speed.
Inputs 0 to 127 set direction to 0 (reverse) and speed to 254 to 0 respectively Inputs 128 to 255 set direction to 1 (forward) and speed to 0 to 256 respectively This means than an input of 0 will produce full speed reverse, and input of 127 will produce stop and 255 will produce full speed forward. Truth table: input A B 0 0 254 100 0 54 127 255 0 128 255 2 203 255 146 255 255 256
This is compatible with many motor controllers, such as the Arduino Motor Shield (L298N) (SKU:DRI0009) and many others
Input the value to be used to set the 2 output Setters. Input of 127 produces 255 on A and 0 on B (forward but stopped) Input of 128 to 255 translates to output Setter A to 256 (forward) and output Setter B at 0 to 254 (full speed). Input of 127 to 0 translates to output Setter A to 0 (reverse) and output Setter B at 0 to 254 (full speed).
|[in]||value||The input value to set.|
Reimplemented from Setter.