TI RSLK Library 0.2.2
|
Class for Pololu's Sharp GP2Y0A21YK0F analog distance sensor. More...
#include <GP2Y0A21_Sensor.h>
Public Member Functions | |
bool | begin (uint8_t pin_num, uint8_t mode=INPUT_PULLDOWN) |
Initialize the distance sensor class. | |
uint16_t | read () |
Read the value from distance sensor. | |
int16_t | readMM () |
Read the distance from the Sharp distance sensor in millimeters. | |
float | readIN () |
Read the distance from the Sharp distance sensor in inches. | |
Class for Pololu's Sharp GP2Y0A21YK0F analog distance sensor.
An instance of this class represents a single [Sharp GP2Y0A21YK0F] (https://www.pololu.com/product/136) distance sensor.
Definition at line 10 of file GP2Y0A21_Sensor.h.
GP2Y0A21_Sensor::GP2Y0A21_Sensor | ( | ) |
Definition at line 6 of file GP2Y0A21_Sensor.cpp.
bool GP2Y0A21_Sensor::begin | ( | uint8_t | pin_num, |
uint8_t | mode = INPUT_PULLDOWN |
||
) |
Initialize the distance sensor class.
This function needs to be called before any other function is used.
[in] | pin_num | on Launchpad connected to distance sensor's analog output. |
[in] | mode | for input pin. Options are the same as standard Energia / Arduino pin mode. |
Definition at line 11 of file GP2Y0A21_Sensor.cpp.
uint16_t GP2Y0A21_Sensor::read | ( | ) |
Read the value from distance sensor.
This function returns a value representing the distance an object is from the sensor.
Definition at line 18 of file GP2Y0A21_Sensor.cpp.
int16_t GP2Y0A21_Sensor::readMM | ( | ) |
Read the distance from the Sharp distance sensor in millimeters.
This function returns a value representing the distance an object is from the sensor in millimeters. Range is 100 to 800 mm.
Definition at line 23 of file GP2Y0A21_Sensor.cpp.
float GP2Y0A21_Sensor::readIN | ( | ) |
Read the distance from the Sharp distance sensor in inches.
This function returns a value representing the distance an object is from the sensor in inches. Range is ~4 to 31 inches.
Definition at line 38 of file GP2Y0A21_Sensor.cpp.