Allows the M3Pi to be used as a Sumo robot, using the sharp 100 distance sensors on the front. Run away strategy
SharpDigiDist100 Class Reference
A class which interfaces with a Sharp Digital Distance sensor (GP2Y0D810) More...
#include <SharpDigiDist100.h>
Public Types | |
enum | Distance |
The enum which makes up the output. More... | |
Public Member Functions | |
SharpDigiDist100 (PinName pin) | |
Create a sensor input. | |
int | getDistance () |
Returns the distace as an enum. | |
void | attachOnChange (void(*ptr)(void)) |
Attaches a function which is called on distance change. |
Detailed Description
A class which interfaces with a Sharp Digital Distance sensor (GP2Y0D810)
Example:
Definition at line 15 of file SharpDigiDist100.h.
Member Enumeration Documentation
enum Distance |
The enum which makes up the output.
Definition at line 30 of file SharpDigiDist100.h.
Constructor & Destructor Documentation
SharpDigiDist100 | ( | PinName | pin ) |
Create a sensor input.
- Parameters:
-
pin The pin the output of the sensor is connected to
Definition at line 3 of file SharpDigiDist100.cpp.
Member Function Documentation
void attachOnChange | ( | void(*)(void) | ptr ) |
Attaches a function which is called on distance change.
- Parameters:
-
A pointer to a function with params/returns: void func(void)
Definition at line 52 of file SharpDigiDist100.cpp.
int getDistance | ( | ) |
Returns the distace as an enum.
- Returns:
- The distance code: 1 is near, 2 is middle distance and 3 is far
Definition at line 47 of file SharpDigiDist100.cpp.
Generated on Wed Aug 3 2022 20:07:45 by 1.7.2