RoboJDETM v2.0

com.ridgesoft.robotics.sensors
Class SharpGP2Y0A21

java.lang.Object
  extended by com.ridgesoft.robotics.sensors.SharpGP2D12
      extended by com.ridgesoft.robotics.sensors.SharpGP2Y0A21
All Implemented Interfaces:
RangeFinder

public class SharpGP2Y0A21
extends SharpGP2D12

Class to interface with the Sharp GP2Y0A21 infrared range finder.


Field Summary
 
Fields inherited from class com.ridgesoft.robotics.sensors.SharpGP2D12
mInput, mPowerControl, mSample, mScaleFactor
 
Constructor Summary
SharpGP2Y0A21(AnalogInput input, DigitalOutput powerControl)
          Constructs a SharpGP2Y0A21 range finder object.
 
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.
 
Methods inherited from class com.ridgesoft.robotics.sensors.SharpGP2D12
getDistanceInches, ping
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

SharpGP2Y0A21

public SharpGP2Y0A21(AnalogInput input,
                     DigitalOutput powerControl)
Constructs a SharpGP2Y0A21 range finder object.

Parameters:
input - analog input receiving sensor output
powerControl - 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.
Method Detail

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

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com