public class IRObstacleAvoidanceModule extends GPIOComponent
When there is no object ahead, infrared-receiver cannot receive signals; when there is an object ahead, it will block and reflect infrared light, then infrared-receiver can receive signals.
Notes:
Datasheet: Differential Comparator
Example of use: IRObstacleAvoidanceModuleExample
Modifier and Type | Field and Description |
---|---|
protected com.pi4j.io.gpio.GpioPinDigitalInput |
digitalInput |
gpio
Constructor and Description |
---|
IRObstacleAvoidanceModule(GPIOPin pin)
Constructor for a new infrared obstacle avoidance module using a specific Gpio pin.
|
Modifier and Type | Method and Description |
---|---|
com.pi4j.io.gpio.GpioPinDigitalInput |
getGpioPinDigitalInput()
Get the pi4j GpioPinDigitalInput corresponding to this IR obstacle avoidance module.
|
boolean |
obstacleDetected()
Returns true if an obstacle is currently detected by the module.
|
getType
public IRObstacleAvoidanceModule(GPIOPin pin)
pin
- the Gpio pin to use to deal with the module.public boolean obstacleDetected()
public com.pi4j.io.gpio.GpioPinDigitalInput getGpioPinDigitalInput()
This can be usefull to add custom listeners to easily react when the module detects an obstacle.