Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class DigitalOutput

    java.lang.Object
      edu.wpi.first.wpilibj.SensorBase
          edu.wpi.first.wpilibj.InterruptableSensorBase
              edu.wpi.first.wpilibj.DigitalSource
                  edu.wpi.first.wpilibj.DigitalOutput

All Implemented Interfaces:
  LiveWindowSendable, IDevice, IInputOutput, Sendable

    public class DigitalOutput

extends DigitalSource
implements IInputOutput, LiveWindowSendable

Class to write digital outputs. This class will wrtie digital outputs. Other devices that are implemented elsewhere will automatically allocate digital inputs and outputs as required.

Field Summary

Fields inherited from class edu.wpi.first.wpilibj.InterruptableSensorBase
`interrupts, m_interrupt, m_interruptIndex, m_manager`

Fields inherited from class edu.wpi.first.wpilibj.SensorBase
`kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond`

Constructor Summary
`DigitalOutput(int channel)` Create an instance of a digital output.
`DigitalOutput(int moduleNumber, int channel)` Create an instance of a digital output.

Method Summary
`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` | `getAnalogTriggerForRouting()` Is this an analog trigger
`int` | `getChannel()`
`int` | `getChannelForRouting()` Get the channel routing number
`int` | `getModuleForRouting()` Get the module routing number
`String` | `getSmartDashboardType()`
`ITable` | `getTable()`
`void` | `initTable(ITable subtable)` Initializes a table for this sendable object.
`boolean` | `isPulsing()` Determine if the pulse is still going.
`void` | `pulse(double length)` Output a single pulse on the digital output line.
`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.

Methods inherited from class edu.wpi.first.wpilibj.InterruptableSensorBase
`allocateInterrupts, cancelInterrupts, disableInterrupts, enableInterrupts, readInterruptTimestamp, waitForInterrupt`

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
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DigitalOutput

    public DigitalOutput(int moduleNumber,
                         int channel)

  Create an instance of a digital output. Create an instance of a digital output given a module number and channel.

  Parameters:
    `moduleNumber` - The number of the digital module to use
    `channel` - the port to use for the digital output

### DigitalOutput

    public DigitalOutput(int channel)

  Create an instance of a digital output. Create a digital output given a channel. The default module is used.

  Parameters:
    `channel` - the port to use for the digital output

Method Detail

### free

    public void free()

  Free the resources associated with a digital output.

  Overrides:
    `free` in class `SensorBase`

### set

    public void set(boolean value)

  Set the value of a digital output.

  Parameters:
    `value` - true is on, off is false

### getChannel

    public int getChannel()

  Returns:
    The GPIO channel number that this object represents.

### pulse

    public void pulse(double length)

  Output a single pulse on the digital output line. Send a single pulse on the digital output line where the pulse diration is specified in seconds. Maximum pulse length is 0.0016 seconds.

  Parameters:
    `length` - The pulselength in seconds

### isPulsing

    public boolean isPulsing()

  Determine if the pulse is still going. Determine if a previously started pulse is still going.

  Returns:
    true if pulsing

### setPWMRate

    public void setPWMRate(double rate)

  Change the PWM frequency of the PWM output on a Digital Output line. The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is logarithmic. There is only one PWM frequency per digital module.

  Parameters:
    `rate` - The frequency to output all digital output PWM signals on this module.

### enablePWM

    public void enablePWM(double initialDutyCycle)

  Enable a PWM Output on this line. Allocate one of the 4 DO PWM generator resources from this module. 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.

  Parameters:
    `initialDutyCycle` - The duty-cycle to start generating. [0..1]

### disablePWM

    public void disablePWM()

  Change this line from a PWM output back to a static Digital Output line. Free up one of the 4 DO PWM generator resources that were in use.

### updateDutyCycle

    public void updateDutyCycle(double dutyCycle)

  Change the duty-cycle that is being generated on the line. 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.

  Parameters:
    `dutyCycle` - The duty-cycle to change to. [0..1]

### getChannelForRouting

    public int getChannelForRouting()

  Description copied from class: `DigitalSource`
  Get the channel routing number

  Specified by:
    `getChannelForRouting` in class `DigitalSource`
  Returns:
    The value to be written to the channel field of a routing mux.

### getModuleForRouting

    public int getModuleForRouting()

  Description copied from class: `DigitalSource`
  Get the module routing number

  Specified by:
    `getModuleForRouting` in class `DigitalSource`
  Returns:
    The value to be written to the module field of a routing mux.

### getAnalogTriggerForRouting

    public boolean getAnalogTriggerForRouting()

  Description copied from class: `DigitalSource`
  Is this an analog trigger

  Specified by:
    `getAnalogTriggerForRouting` in class `DigitalSource`
  Returns:
    The value to be written to the analog trigger field of a routing mux.

### getSmartDashboardType

    public String getSmartDashboardType()

  Specified by:
    `getSmartDashboardType` in interface `Sendable`
  Returns:
    the string representation of the named data type that will be used by the smart dashboard for this sendable

### initTable

    public void initTable(ITable subtable)

  Initializes a table for this sendable object.

  Specified by:
    `initTable` in interface `Sendable`
  Parameters:
    `subtable` - The table to put the values in.

### getTable

    public ITable getTable()

  Specified by:
    `getTable` in interface `Sendable`
  Returns:
    the table that is currently associated with the sendable

### updateTable

    public void updateTable()

  Update the table for this sendable object with the latest values.

  Specified by:
    `updateTable` in interface `LiveWindowSendable`

### startLiveWindowMode

    public void startLiveWindowMode()

  Start having this sendable object automatically respond to value changes reflect the value on the table.

  Specified by:
    `startLiveWindowMode` in interface `LiveWindowSendable`

### stopLiveWindowMode

    public void stopLiveWindowMode()

  Stop having this sendable object automatically respond to value changes.

  Specified by:
    `stopLiveWindowMode` in interface `LiveWindowSendable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"