Now you can download a copy of these docs so you can use them offline! Download now

Relay Class Reference

#include <Relay.h>

Inheritance diagram for Relay:
Collaboration diagram for Relay:

List of all members.

Public Types

enum  Value { kOff, kOn, kForward, kReverse }
enum  Direction { kBothDirections, kForwardOnly, kReverseOnly }

Public Member Functions

 Relay (UINT32 channel, Direction direction=kBothDirections)
 Relay (UINT8 moduleNumber, UINT32 channel, Direction direction=kBothDirections)
virtual ~Relay ()
void Set (Value value)

Detailed Description

Class for Spike style relay outputs. Relays are intended to be connected to spikes or similar relays. The relay channels controls a pair of pins that are either both off, one on, the other on, or both on. This translates into two spike outputs at 0v, one at 12v and one at 0v, one at 0v and the other at 12v, or two spike outputs at 12V. This allows off, full forward, or full reverse control of motors without variable speed. It also allows the two channels (forward and reverse) to be used independently for something that does not care about voltage polatiry (like a solenoid).

Definition at line 23 of file Relay.h.


Constructor & Destructor Documentation

Relay::Relay ( UINT32  channel,
Relay::Direction  direction = kBothDirections 
)

Relay constructor given a channel only where the default digital module is used.

Parameters:
channel The channel number within the default module for this relay.
direction The direction that the Relay object will control.

Definition at line 83 of file Relay.cpp.

Relay::Relay ( UINT8  moduleNumber,
UINT32  channel,
Relay::Direction  direction = kBothDirections 
)

Relay constructor given the module and the channel.

Parameters:
moduleNumber The digital module this relay is connected to (1 or 2).
channel The channel number within the module for this relay.
direction The direction that the Relay object will control.

Definition at line 71 of file Relay.cpp.

Relay::~Relay (  )  [virtual]

Free the resource associated with a relay. The relay channels are set to free and the relay output is turned off.

Definition at line 94 of file Relay.cpp.


Member Function Documentation

void Relay::Set ( Relay::Value  value  ) 

Set the relay state.

Valid values depend on which directions of the relay are controlled by the object.

When set to kBothDirections, the relay can be any of the four states: 0v-0v, 0v-12v, 12v-0v, 12v-12v

When set to kForwardOnly or kReverseOnly, you can specify the constant for the direction or you can simply specify kOff and kOn. Using only kOff and kOn is recommended.

Parameters:
value The state to set the relay.

Definition at line 123 of file Relay.cpp.


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

Generated on Thu Jan 12 2012 22:35:35 for WPILibC++ by doxygen 1.7.1