upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for Grove Ultrasonic Ranger. More...
This Grove Ultrasonic sensor is a non-contact distance measurement module which is compatible with the Grove system. It is designed for easy modular project usage with industrial performance. Detection ranges from 3 cm (1.2") to 4 m (13'1.5") and works best when the object is within a 30 degree angle relative to the sensor.
Public Member Functions | |
synchronized void | delete () |
GroveUltraSonic (short pin) | |
int | getDistance () |
String | name () |
boolean | working () |
GroveUltraSonic | ( | short | pin | ) |
Instantiates a GroveUltraSonic object
pin | pin for triggering the sensor for distance and for receiving pulse response |
int getDistance | ( | ) |
Returns the echo's pulse width from the sensor in microseconds. Divide by 58 to convert distance to centimetres. Divide by 148 to convert distance to inches.
String name | ( | ) |
Return name of the component
boolean working | ( | ) |
Returns true while the sensor is busy waiting for the echo pulse