public class Relay extends SensorBase implements LiveWindowSendable
Modifier and Type | Class and Description |
---|---|
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.
|
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPDPChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
Relay(int channel)
Relay constructor given a channel, allowing both directions.
|
Relay(int channel,
Relay.Direction direction)
Relay constructor given a channel.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Free the resources used by this object
|
Relay.Value |
get()
Get the Relay State
Gets the current state of the relay.
|
String |
getSmartDashboardType() |
edu.wpi.first.wpilibj.tables.ITable |
getTable() |
void |
initTable(edu.wpi.first.wpilibj.tables.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.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
public Relay(int channel, Relay.Direction direction)
channel
- The channel number for this relay.direction
- The direction that the Relay object will control.public Relay(int channel)
channel
- The channel number for this relay.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 String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(edu.wpi.first.wpilibj.tables.ITable subtable)
public edu.wpi.first.wpilibj.tables.ITable getTable()
public void updateTable()
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable
Copyright © 2015. All rights reserved.