TI RSLK Library
0.2.0
|
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. More... | |
uint16_t | read () |
Read the value from distance sensor. More... | |
Class for Pololu's Sharp GP2Y0A21YK0F analog distance sensor.
An instance of this class represents a single Sharp GP2Y0A21YK0F distance sensor.
Definition at line 10 of file GP2Y0A21_Sensor.h.
bool GP2Y0A21_Sensor::begin | ( | uint8_t | pin_num, |
uint8_t | mode = INPUT_PULLDOWN |
||
) |
Initialize the distance sensor class.
[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. |
This function needs to be called before any other function is used.
Definition at line 9 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 16 of file GP2Y0A21_Sensor.cpp.