Class TCRT1000

  • All Implemented Interfaces:
    FlinkDefinitions, Iarm32, Actionable, Izynq7000

    public class TCRT1000
    extends Task
    implements Izynq7000, FlinkDefinitions
    Driver for up to 16 pulsed and multiplexed TCRT1000 or HLC1393 reflection distance sensors.
    The driver needs 5 digital outputs and a single analog input of an AD7476. 4 of the digital outputs are used as address channels and the fifth one is the trigger signal. The analog input is used to read the sensor values.
    All the sensors are repetitively sampled within 16ms, regardless of the number of sensors.
    • Method Detail

      • getInstance

        public static TCRT1000 getInstance()
        Returns an instance of TCRT1000
        Returns:
        Instance of TCRT1000
      • read

        public short read​(int channel)
        Read the value of the given sensor number
        Parameters:
        channel - channel/sensor number
        Returns:
        converted value
      • action

        public void action()
        Background task loop: Do not call this method!
        Specified by:
        action in interface Actionable
        Overrides:
        action in class Task
      • init

        public void init​(int nofSensors,
                         int addr3Pin,
                         int addr2Pin,
                         int addr1Pin,
                         int addr0Pin,
                         int trigPin)
        Initialize sensors. Unused address inputs must be initialized with -1
        Parameters:
        nofSensors - Number of connected sensors: 0 < numberOfSensors <= 16
        addr3Pin - Highest order address pin
        addr2Pin - Address pin
        addr1Pin - Address pin
        addr0Pin - Lowest order address pin
        trigPin - Trigger pin
      • stop

        public void stop()
        Stop reading the sensors.
      • start

        public void start()
        Start reading the sensors.
        This method must be called after the initialization or after a call of stop().