com.ridgesoft.robotics.sensors
Class SharpGP2Y0A02
java.lang.Object
com.ridgesoft.robotics.sensors.SharpGP2D12
com.ridgesoft.robotics.sensors.SharpGP2Y0A02
- All Implemented Interfaces:
- RangeFinder
public class SharpGP2Y0A02
- extends SharpGP2D12
Class to interface with the Sharp GP2Y0A02 infrared range finder.
Method Summary |
float |
getDistanceCm()
Gets the distance to the nearest object in centimeters based on an curve fitting
apporximation of the output voltage verse distance curve. |
SharpGP2Y0A02
public SharpGP2Y0A02(AnalogInput input,
DigitalOutput powerControl)
- Constructs a SharpGP2Y0A02 range finder object.
- Parameters:
input
- analog input receiving sensor outputpowerControl
- digital output used to control the power to the sensor.
Should be null if power is always on. When power switching
is used, the ping() method sleeps for 70 milliseconds after
powering up the sensor.
getDistanceCm
public float getDistanceCm()
- Gets the distance to the nearest object in centimeters based on an curve fitting
apporximation of the output voltage verse distance curve.
- Specified by:
getDistanceCm
in interface RangeFinder
- Overrides:
getDistanceCm
in class SharpGP2D12
- Returns:
- distance in inches or -1 if out of valid measurement range
Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com