public class DigitalOutput extends DigitalSource implements LiveWindowSendable
InterruptableSensorBase.WaitResult
m_interrupt, m_isSynchronousInterrupt
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
DigitalOutput(int channel)
Create an instance of a digital output.
|
Modifier and Type | Method and Description |
---|---|
void |
disablePWM()
Change this line from a PWM output back to a static Digital Output line.
|
void |
enablePWM(double initialDutyCycle)
Enable a PWM Output on this line.
|
void |
free()
Free the resources associated with a digital output.
|
boolean |
get()
Gets the value being output from the Digital Output.
|
int |
getAnalogTriggerTypeForRouting()
Get the analog trigger type.
|
int |
getChannel() |
int |
getPortHandleForRouting()
Get the HAL Port Handle.
|
java.lang.String |
getSmartDashboardType()
The string representation of the named data type that will be used by the smart dashboard for
this
Sendable . |
ITable |
getTable()
The table that is associated with this
Sendable . |
void |
initTable(ITable subtable)
Initializes a table for this
Sendable object. |
boolean |
isAnalogTrigger()
Is this an analog trigger.
|
boolean |
isPulsing()
Determine if the pulse is still going.
|
void |
pulse(double pulseLength)
Generate a single pulse.
|
void |
pulse(int channel,
double pulseLength)
Deprecated.
Use
pulse(double) instead. |
void |
pulse(int channel,
int pulseLength)
Deprecated.
Generate a single pulse. Write a pulse to the specified digital output channel.
There can only be a single pulse going at any time.
|
void |
set(boolean value)
Set the value of a digital output.
|
void |
setPWMRate(double rate)
Change the PWM frequency of the PWM output on a Digital Output line.
|
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 |
updateDutyCycle(double dutyCycle)
Change the duty-cycle that is being generated on the line.
|
void |
updateTable()
Update the table for this sendable object with the latest values.
|
allocateInterrupts, cancelInterrupts, disableInterrupts, enableInterrupts, readFallingTimestamp, readRisingTimestamp, requestInterrupts, requestInterrupts, setUpSourceEdge, waitForInterrupt, waitForInterrupt
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
public DigitalOutput(int channel)
channel
- the DIO channel to use for the digital output. 0-9 are on-board, 10-25 are on
the MXPpublic void free()
free
in class SensorBase
public void set(boolean value)
value
- true is on, off is falsepublic boolean get()
public int getChannel()
getChannel
in class DigitalSource
public void pulse(double pulseLength)
pulseLength
- The length of the pulse.@Deprecated public void pulse(int channel, double pulseLength)
pulse(double)
instead.channel
- UnusedpulseLength
- The length of the pulse.@Deprecated public void pulse(int channel, int pulseLength)
channel
- UnusedpulseLength
- The length of the pulse.public boolean isPulsing()
public void setPWMRate(double rate)
The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is logarithmic.
There is only one PWM frequency for all channnels.
rate
- The frequency to output all digital output PWM signals.public void enablePWM(double initialDutyCycle)
Allocate one of the 6 DO PWM generator resources.
Supply the initial duty-cycle to output so as to avoid a glitch when first starting.
The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less) but is reduced the higher the frequency of the PWM signal is.
initialDutyCycle
- The duty-cycle to start generating. [0..1]public void disablePWM()
Free up one of the 6 DO PWM generator resources that were in use.
public void updateDutyCycle(double dutyCycle)
The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less) but is reduced the higher the frequency of the PWM signal is.
dutyCycle
- The duty-cycle to change to. [0..1]public int getAnalogTriggerTypeForRouting()
getAnalogTriggerTypeForRouting
in class InterruptableSensorBase
public boolean isAnalogTrigger()
isAnalogTrigger
in class DigitalSource
public int getPortHandleForRouting()
getPortHandleForRouting
in class InterruptableSensorBase
public java.lang.String getSmartDashboardType()
Sendable
Sendable
.getSmartDashboardType
in interface Sendable
Sendable
.public void initTable(ITable subtable)
Sendable
Sendable
object.public ITable getTable()
Sendable
Sendable
.public void updateTable()
LiveWindowSendable
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
LiveWindowSendable
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
LiveWindowSendable
stopLiveWindowMode
in interface LiveWindowSendable