Rangefinder

Functions for using the IR rangefinders. More...


Defines

#define IR1   6
 IR Rangefinder 1.
#define IR2   5
 IR Rangefinder 2.
#define IR3   4
 IR Rangefinder 3.
#define IR4   3
 IR Rangefinder 4.
#define IR5   2
 IR Rangefinder 5.
#define MIN_IR_ADC8   20
 smallest meaningful rangefinder reading (logarithmic scale)
#define MAX_IR_ADC8   133
 largest meaningful rangefinder reading (logarithmic scale)

Functions

int range_init (void)
 Initialize the rangefinders.
int range_read_distance (int range_id)
 Read the distance from a rangefinder.
int linearize_distance (int value)
 Convert logarithmic-scale distance readings to a linear scale.


Detailed Description

Functions for using the IR rangefinders.

Functions for using the IR rangefinders.


Function Documentation

int linearize_distance ( int  value  ) 

Convert logarithmic-scale distance readings to a linear scale.

Transforms distance readings from logarithmic to linear scale. This probably isn't the function you are looking for.

Note: pgm_read_word() needs additional testing

Parameters:
value the 8-bit analog value from rangefinder
Returns:
linearized distance reading from rangefinder (integer in [101,800])

int range_init ( void   ) 

Initialize the rangefinders.

Initializes the rangefinders. This must be called before range_read_distance.

Returns:
0 if init succesfull, an error code otherwise
See also:
range_read_distance

int range_read_distance ( int  range_id  ) 

Read the distance from a rangefinder.

Reads the distance measured by one of the rangefinders. This distance is in arbitrary units.

Parameters:
range_id the rangefinder to use. This should be one of the constants IR1 - IR5.
Returns:
the distance measured by the rangefinder, or an error code
See also:
range_init


Generated on Fri Nov 20 21:51:59 2009 for Colony by  doxygen 1.5.8