public class GP2Y0A21YK extends AnalogInputDevice implements DistanceSensorInterface
Sharp GP2Y0A21YK distance sensor. Datasheet, Guide. Important to supply 5V to get correct readings (max output voltage ~3.2V).
Range: 10 to 80 cm Typical response time: 39 ms Typical start up delay: 44 ms Average Current Consumption: 30 mA Detection Area Diameter @ 80 cm: 12 cm Supply voltage : 4.5 to 5.5 V
listeners
gpio
Constructor and Description |
---|
GP2Y0A21YK(AnalogInputDeviceFactoryInterface deviceFactory,
int gpio) |
GP2Y0A21YK(int gpio) |
Modifier and Type | Method and Description |
---|---|
float |
getDistanceCm()
Read distance in centimetres, range 10 to 80cm.
|
addListener, addListener, close, disableListener, enableListener, getScaledValue, getUnscaledValue, getVRef, run
addListener, removeAllListeners, removeListener, valueChanged
getGpio
public GP2Y0A21YK(int gpio) throws RuntimeIOException
RuntimeIOException
public GP2Y0A21YK(AnalogInputDeviceFactoryInterface deviceFactory, int gpio) throws RuntimeIOException
RuntimeIOException
public float getDistanceCm() throws RuntimeIOException
getDistanceCm
in interface DistanceSensorInterface
RuntimeIOException
Copyright © 2016–2017 mattjlewis. All rights reserved.