![]() |
RTOS_MSPM0
1.1
ECE445M starter code
|
Take infrared distance measurements. More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| int32_t | IRDistance_Convert (int32_t adcSample, uint32_t sensor) |
| Convert infrared distance measurement. More... | |
Take infrared distance measurements.
Provide mid-level functions that convert raw ADC values from the GP2Y0A21YK0F infrared distance sensors to distances in mm.
| int32_t IRDistance_Convert | ( | int32_t | adcSample, |
| uint32_t | sensor | ||
| ) |
Convert infrared distance measurement.
Convert ADC sample into distance for the GP2Y0A21YK0F infrared distance sensor. Conversion uses a calibration formula
D = A/(adcSample + B) + C
| adcSample | is the 12-bit ADC sample 0 to 4095 |
| sensor | is sensor number 0 to 3 |