Both of these add-ons use the imp006 Breakout Kit’s two Grove connectors. The ultrasonic ranger should be fitted to the out connector, marked Grove pinN & pinXN on the board, and the display to the inner connector, marked I2C Grove i2cTU.
Note To swap the connectors, you will need to change the hardware.pin objects passed into the two class constructors on lines 340 and 343.
The code takes regular range readings, one every second. The measured distance, in centimeters, is shown on the four-digit display. The effective range of the ultrasonic ranger is 400cm (four metres). When the range falls to 20cm or less, the code sends a suitable message to the agent. A measured range of zero is an indication that an error occurred in the measuring operation.