|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ridgesoft.intellibrain.IntelliBrainPinPort
com.ridgesoft.intellibrain.IntelliBrainDigitalIO
public class IntelliBrainDigitalIO
Class representing a single digital input/output port.
The digital ports may be used as digital inputs or digital outputs.
Pulse input measurement is supported on ports 3 through 6.
Pulse output is supported on any digital port, even when configured as an input.
By default the port is configured as a digital input.
Method Summary | |
---|---|
void |
clear()
Clears the digital output (sets it low) if the port is configured as an output. |
void |
enablePulseMeasurement(boolean enable)
Enables pulse measurement. |
boolean |
isSet()
Samples the state of the port's signal pin. |
void |
pulse(int duration)
Outputs a pulse to the digital port signal pin. |
void |
pulse(int duration,
boolean highPulse)
Outputs a pulse to the digital port signal pin. |
int |
readEdgeCount()
Gets the count of rising and falling edges detected on this input since pulse measurement was enabled. |
int |
readPulseDuration()
Gets the duration of the last high pulse. |
int |
readPulseDuration(boolean highPulse)
Gets the duration of the last high or low pulse. |
void |
set()
Sets the digital ouput high if the port is configured as an output. |
void |
setDirection(boolean isOutput)
Configures the port as an input or output. |
void |
toggle()
Toggles the digital output. |
String |
toString()
Samples the port and returns the String "true" if the digital is set and "false" if it is clear. |
Methods inherited from class com.ridgesoft.intellibrain.IntelliBrainPinPort |
---|
setPullUp |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait |
Method Detail |
---|
public void clear()
Does nothing if the port is configured as an input.
clear
in interface DigitalOutput
public void enablePulseMeasurement(boolean enable)
Digital IO ports 3 through 6 support pulse measurement.
enablePulseMeasurement
in interface PulseInput
enable
- true enables pulse measurement, false disables pulse measurement
UnsupportedOperationException
- if the port does not support pulse measurementpublic boolean isSet()
isSet
in interface DigitalInput
isSet
in interface DigitalOutput
isSet
in class IntelliBrainPinPort
public void pulse(int duration)
If the port is configured as an input port it will be reconfigured to an output for the duration of the pulse.
The IntelliBrain robotics controller supports durations up to about 140 milliseconds.
pulse
in interface PulseOutput
duration
- duration of the pulse in microsecondspublic void pulse(int duration, boolean highPulse)
If the port is configured as an input port it will be reconfigured to an output for the duration of the pulse.
The IntelliBrain robotics controller supports durations up to about 140 milliseconds.
duration
- duration of the pulse in microsecondshighPulse
- generates a high pulse if true and a low pulse if falsepublic int readEdgeCount()
Pulse measurement must be enabled using the enablePulseMeasurement method.
readEdgeCount
in interface PulseInput
public int readPulseDuration()
The resolution is about 4 microseconds and the maximum pulse duration is about 250 milliseconds.
The method enablePulseMeasurement must be called prior to calling this method.
readPulseDuration
in interface PulseInput
public int readPulseDuration(boolean highPulse)
The resolution is about 4 microseconds and the maximum pulse duration is about 250 milliseconds.
The method enablePulseMeasurement must be called prior to calling this method.
readPulseDuration
in interface PulseInput
highPulse
- true to read the duration of the last high pulse, false to read the duration of the last low pulse
public void set()
Does nothing if the port is configured as an input.
set
in interface DigitalOutput
public void setDirection(boolean isOutput)
When configuring a port to be an input, its value is cleared.
When configuring a port to be an output, the pull-up resistor is disabled.
By default digital ports are configured as inputs.
isOutput
- true if the port is to be configured as an output, false if it is to be
configured as an inputpublic void toggle()
toggle
in interface DigitalOutput
public String toString()
toString
in class Object
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |