Ultrasonic Range Detector
An extremely easy to use ultrasonic sensor that can accurately determine the distance to an object. When connected to a MicroMite, just one command will give you an accurate measurement.
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package. Operating range is from 2cm to 400 cm (1” to 13 feet). Its operation is not affected by sunlight or black material (although acoustically soft materials like cloth can be difficult to detect). It comes complete with ultrasonic transmitter and receiver transducers; and connects easily to a MicroMite with just four wires.
The following creates a basic Digital Tape Measure:'This code is for a 28-pin MicroMite using 5v tolerant I/Ostrig = 14 ' replace with appropriate MicroMite pin number that the UltraSonic Trig signal is connected toecho = 15 ' replace with appropriate MicroMite pin number that the Ultrasonic Echo signal is connected todoPrint Distance(trig, echo)pause 200loop