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
pinNumber
Constructor and Description |
---|
GP2Y0A21YK(AnalogInputDeviceFactoryInterface deviceFactory,
int pinNumber,
float vRef) |
GP2Y0A21YK(int pinNumber,
float vRef) |
Modifier and Type | Method and Description |
---|---|
float |
getDistanceCm()
Read distance in centimetres, range 10 to 80cm.
|
addListener, addListener, close, disableListener, enableListener, getScaledValue, getUnscaledValue, run
addListener, removeAllListeners, removeListener, valueChanged
getPinNumber
public GP2Y0A21YK(int pinNumber, float vRef) throws RuntimeIOException
RuntimeIOException
public GP2Y0A21YK(AnalogInputDeviceFactoryInterface deviceFactory, int pinNumber, float vRef) throws RuntimeIOException
RuntimeIOException
public float getDistanceCm() throws RuntimeIOException
getDistanceCm
in interface DistanceSensorInterface
RuntimeIOException
Copyright © 2016 mattjlewis. All rights reserved.