The oSonarPL Object handles all the necessary I/O timing required to communicate with the Polaroid Ultrasonic Range Finder and measure the distance between the sonar transducer and its target. When the oSonarPL Object's Operate property transitions from 0 to 1, the sonar unit is instructed to send a ping signal, the Transmitting property is set to 1 and the Received property is cleared to 0. After which, the oSonarDV Object waits for an echo. Once the echo is received, the time-of-flight of the echo is stored in the Distanceproperty, the Transmitting property is cleared to 0 and the Received property is set to 1. If no echo was received after a short period of time, the Transmitting property is cleared to 0 and the TimeOut property is set to 1. A single sonar ping is sent for each time that the Operate property transitions from 0 to 1 which results in a single sonar reading being updated into the Distance property. This is different than most of the other ooPIC Objects which continually update the properties. This difference was designed into the oSonarPL Object so that multiple sonar units could be controlled without Ultrasonic interference between them. To continually update the Distance property, the Operate property needs to be toggled at the rate that the sonar needs to be monitored. This can be accomplished by linking the Output property of an oClock to the Operate property of the oSonarDV Object. The FeedBack property is an instance of the oFeedBack1T Object which is created when the oSonarPL Object is. The oSonarPL Object uses the oFeedBack1T Object to do the actual ping/echo timing for the sonar. (see oFeedBack1T Object for more detail on how the sonar is controlled.) |