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. |
Functions for using the IR rangefinders.
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
value | the 8-bit analog value from rangefinder |
int range_init | ( | void | ) |
Initialize the rangefinders.
Initializes the rangefinders. This must be called before 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.
range_id | the rangefinder to use. This should be one of the constants IR1 - IR5. |