RCKit
Public Member Functions
MotorControllerSetter Class Reference

Setter class that outputs its value to a MotorController configured on 1 digital and one analog output pins. More...

#include <MotorControllerSetter.h>

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

List of all members.

Public Member Functions

 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 ()
 Constructor.
 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 MotorController configured on 1 digital and one analog output pins.

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

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

Typically the outputs would be a DigitalSetter and an AnalogSetter to control a motor through a digital (direction) and an analog (PWM speed) outputs

Examples:
TestSuite.pde.

Constructor & Destructor Documentation

MotorControllerSetter::MotorControllerSetter ( Setter targetA,
Setter targetB 
)
Parameters:
[in]targetAThe Setter to use for direction, typically a DigitalSetter.
[in]targetBThe Setter to use for speed, typically an AnalogSetter.
Author:
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m)

Member Function Documentation

void MotorControllerSetter::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().

void MotorControllerSetter::input ( int  value)
virtual

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).

Parameters:
[in]valueThe input value to set.

Reimplemented from Setter.

References Setter::input().

void MotorControllerSetter::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: