|
|||||||||
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.InterruptableSensorBase
edu.wpi.first.wpilibj.DigitalSource
edu.wpi.first.wpilibj.DigitalInput
public class DigitalInput
Class to read a digital input. This class will read digital inputs and return the current value on the channel. Other devices such as encoders, gear tooth sensors, etc. that are implemented elsewhere will automatically allocate digital inputs and outputs as required. This class is only for devices like switches etc. that aren't implemented anywhere else.
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 | |
---|---|
DigitalInput(int channel)
Create an instance of a Digital Input class. |
|
DigitalInput(int moduleNumber,
int channel)
Create an instance of a Digital Input class. |
Method Summary | |
---|---|
void |
free()
Free the resources used by this object |
boolean |
get()
Get the value from a digital input channel. |
boolean |
getAnalogTriggerForRouting()
Is this an analog trigger |
int |
getChannel()
Get the channel of the digital input |
int |
getChannelForRouting()
Get the channel routing number |
int |
getModuleForRouting()
Get the module routing number |
java.lang.String |
getSmartDashboardType()
|
ITable |
getTable()
|
void |
initTable(ITable subtable)
Initializes a table for this sendable object. |
void |
requestInterrupts()
Request interrupts synchronously on this digital input. |
void |
requestInterrupts(java.lang.Object handler,
java.lang.Object param)
Request interrupts asynchronously on this digital input. |
void |
setUpSourceEdge(boolean risingEdge,
boolean fallingEdge)
Set which edge to trigger interrupts on |
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.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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DigitalInput(int channel)
channel
- the port for the digital inputpublic DigitalInput(int moduleNumber, int channel)
moduleNumber
- The number of the digital module to use for this inputchannel
- the port for the digital inputMethod Detail |
---|
public void free()
SensorBase
free
in class SensorBase
public boolean get()
public int getChannel()
public int getChannelForRouting()
DigitalSource
getChannelForRouting
in class DigitalSource
public int getModuleForRouting()
DigitalSource
getModuleForRouting
in class DigitalSource
public boolean getAnalogTriggerForRouting()
DigitalSource
getAnalogTriggerForRouting
in class DigitalSource
public void requestInterrupts(java.lang.Object handler, java.lang.Object param)
handler
- The address of the interrupt handler function of type tInterruptHandler that
will be called whenever there is an interrupt on the digitial input port.
Request interrupts in synchronus mode where the user program interrupt handler will be
called when an interrupt occurs.
The default is interrupt on rising edges only.param
- argument to pass to the handlerpublic void requestInterrupts()
public void setUpSourceEdge(boolean risingEdge, boolean fallingEdge)
risingEdge
- true to interrupt on rising edgefallingEdge
- true to interrupt on falling edgepublic 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 void updateTable()
updateTable
in interface LiveWindowSendable
public ITable getTable()
getTable
in interface Sendable
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 |