2010-12-16 23:01:29 -04:00
# ifndef AP_RangeFinder_SharpGP2Y_H
# define AP_RangeFinder_SharpGP2Y_H
# include "RangeFinder.h"
# define AP_RANGEFINDER_SHARPEGP2Y_MIN_DISTANCE 20
# define AP_RANGEFINDER_SHARPEGP2Y_MAX_DISTANCE 150
class AP_RangeFinder_SharpGP2Y : public RangeFinder
2011-07-30 17:35:36 -03:00
{
2010-12-16 23:01:29 -04:00
public :
2011-07-30 17:35:36 -03:00
AP_RangeFinder_SharpGP2Y ( AP_ADC * adc , ModeFilter * filter ) ;
2011-05-04 16:12:27 -03:00
int convert_raw_to_distance ( int _raw_value ) { if ( _raw_value = = 0 ) return max_distance ; else return 14500 / _raw_value ; } // read value from analog port and return distance in cm
2011-07-30 17:35:36 -03:00
2010-12-16 23:01:29 -04:00
} ;
# endif