|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.SensorBase
edu.wpi.first.wpilibj.Relay
public class Relay
Class for VEX Robotics 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 polarity (like a solenoid).
Nested Class Summary | |
---|---|
static class |
Relay.Direction
The Direction(s) that a relay is configured to operate in. |
class |
Relay.InvalidValueException
This class represents errors in trying to set relay values contradictory to the direction to which the relay is set. |
static class |
Relay.Value
The state to drive a Relay to. |
Field Summary |
---|
Fields inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond |
Constructor Summary | |
---|---|
Relay(int channel)
Relay constructor given a channel only where the default digital module is used, allowing both directions. |
|
Relay(int moduleNumber,
int channel)
Relay constructor given the module and the channel, allowing both directions. |
|
Relay(int moduleNumber,
int channel,
Relay.Direction direction)
Relay constructor given the module and the channel. |
|
Relay(int channel,
Relay.Direction direction)
Relay constructor given a channel only where the default digital module is used. |
Method Summary | |
---|---|
void |
free()
Free the resources used by this object |
Relay.Value |
get()
Get the Relay State Gets the current state of the relay. |
java.lang.String |
getSmartDashboardType()
|
ITable |
getTable()
|
void |
initTable(ITable subtable)
Initializes a table for this sendable object. |
void |
set(Relay.Value value)
Set the relay state. |
void |
setDirection(Relay.Direction direction)
Set the Relay Direction Changes which values the relay can be set to depending on which direction is used Valid inputs are kBothDirections, kForwardOnly, and kReverseOnly |
void |
startLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the table. |
void |
stopLiveWindowMode()
Stop having this sendable object automatically respond to value changes. |
void |
updateTable()
Update the table for this sendable object with the latest values. |
Methods inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Relay(int moduleNumber, int channel, Relay.Direction direction)
moduleNumber
- The number of the digital module to use.channel
- The channel number within the module for this relay.direction
- The direction that the Relay object will control.public Relay(int channel, Relay.Direction direction)
channel
- The channel number within the default module for this relay.direction
- The direction that the Relay object will control.public Relay(int moduleNumber, int channel)
moduleNumber
- The number of the digital module to use.channel
- The channel number within the module for this relay.public Relay(int channel)
channel
- The channel number within the default module for this relay.Method Detail |
---|
public void free()
SensorBase
free
in class SensorBase
public void set(Relay.Value value)
value
- The state to set the relay.public Relay.Value get()
public void setDirection(Relay.Direction direction)
direction
- The direction for the relay to operate inpublic java.lang.String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(ITable subtable)
initTable
in interface Sendable
subtable
- The table to put the values in.public ITable getTable()
getTable
in interface Sendable
public void updateTable()
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |