Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 Fri Jul 15 2022 18:38:42 by
