public class TrackingSensor extends GPIOComponent
Datasheet: tcrt5000
Note: working distance: 12mm from the support (5mm from the leds).
Example of use: TrackingSensorExample
Modifier and Type | Field and Description |
---|---|
protected com.pi4j.io.gpio.GpioPinDigitalInput |
digitalInput |
gpio
Constructor and Description |
---|
TrackingSensor(GPIOPin pin)
Constructor for a tracking sensor using a specific Gpio pin from the Raspberry Pi.
|
Modifier and Type | Method and Description |
---|---|
com.pi4j.io.gpio.GpioPinDigitalInput |
getGpioPinDigitalInput()
Get the pi4j GpioPinDigitalInput used for this tracking sensor.
|
boolean |
whiteDetected()
Returns true if white color is detected.
|
getType
public TrackingSensor(GPIOPin pin)
pin
- the pin to use to manage the tracking sensor.public boolean whiteDetected()
public com.pi4j.io.gpio.GpioPinDigitalInput getGpioPinDigitalInput()
This can be usefull to add custom listeners to easily react when the tracking state changes.