Demand Peripherals     Robotics and Automation Made Easy

PING4: Quad Ping))) Interface

The PING4 peripheral connect to up to four Parallax Ping))) ultrasonic distance sensors. The PING4 peripheral uses the GPIO4 card.



The quad Parallax Ping))) peripherals uses the four bidirectional I/O pins on a GPIO4 card to control up to four Parallax Ping))) sensors. Typically you would use the pin header version of the GPIO4 card and would connect +5 Volts and ground to the auxiliary power connector.



Resources for the in4 peripheral include a read-only data register and a read-write configuration register to determine which pins are monitored for changes.

distance :sensor ID and Distance.
Distance is a read-only resource that works with pccat. The stream of data is line oriented and each line of output has a digit that indicates the sensor number followed by the distance given in units of one-tenth of an inch. A distance of zero indicates that the sensor is not connected or is not responding. Typical output from the distance resource might appear as:

     0 1055
     1 55
     2 0
     3 1848
     0 1094

enable : enable or disable individual sensors.
The enable resource takes a single hexadecimal character terminated by a newline. The LSB of the enable register corresponds to the lowest numbered sensor, sensor ID 0. A set bit enables the sensor and a cleared bit disables it. At start-up all sensors are disabled.

NOTE: Only enable active sensors. The output can stop if a sensor is not present or stops responding.



Enable the first two sensors and start monitoring the reported distances.

      pcset ping4 enable 3
      pccat ping4 distance