RCKit
Public Member Functions | List of all members
HBridgeSetter Class Reference

Setter class that outputs its value to a HBridge configured on 2 output Setter. More...

#include <HBridgeSetter.h>

Inheritance diagram for HBridgeSetter:
Inheritance graph
[legend]
Collaboration diagram for HBridgeSetter:
Collaboration graph
[legend]

Public Member Functions

 HBridgeSetter (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 ()
 Constructor. More...
 
 Setter (Setter *target)
 Constructor with setting the target.
 
virtual void setTarget (Setter *target)
 
void setFailsafeValue (int failsafeValue)
 Sets the failsafeValue.
 
int failsafeValue ()
 

Additional Inherited Members

- Protected Attributes inherited from Setter
Setter_target
 This is the instance of Setter that will be given the transfotmed output value.
 
int _failsafeValue
 

Detailed Description

Setter class that outputs its value to a HBridge configured on 2 output Setter.

Author
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m)

A HBridge is used to drive a motor in forward and reverse directions. It requires 2 Setters as output: one to drive the motor forwards and one to drive it in reverse. When driving forward the reverse output is 0 and vice versa.

Typically the outputs would be AnalogSetters to control a motor through a pair of analog outputs, but could be ServoSetter, AccelStepperSpeedSetter or AccelStepperPositionSetter or any other combination.

Constructor & Destructor Documentation

◆ HBridgeSetter()

HBridgeSetter::HBridgeSetter ( Setter targetA,
Setter targetB 
)
Parameters
[in]targetAThe Setter to use for output A.
[in]targetBThe Setter to use for output B.
Author
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m)

Member Function Documentation

◆ failsafe()

void HBridgeSetter::failsafe ( )
virtual

Called when the source of input data is lost, and the Setter is required to fail in a safe way. Calls the failsafes of targetA and targetB

Reimplemented from Setter.

References Setter::failsafe().

◆ input()

void HBridgeSetter::input ( int  value)
virtual

Input the value to be used to set the 2 output Setters. Input of 127 produces 0 on both outputs (stopped) Input of 128 to 255 translates to output Setter A from 0 to 256 and output Setter B at 0 (forward). Input of 127 to 0 translates to output Setter B from 0 to 254 and output Setter A at 0 (reverse).

Parameters
[in]valueThe input value to set.

Reimplemented from Setter.

References Setter::input().

◆ setTargets()

void HBridgeSetter::setTargets ( Setter targetA,
Setter targetB 
)

Set or change the output pin

Parameters
[in]targetAThe Setter to use for output A.
[in]targetBThe Setter to use for output B.

References Setter::setTarget().


The documentation for this class was generated from the following files: