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.
Dependencies: mbed
IRSensor Class Reference
This is a device driver class to read the distance measured with a Sharp IR sensor. More...
#include <IRSensor.h>
Public Member Functions | |
| IRSensor (AnalogIn *distance, DigitalOut *bit0, DigitalOut *bit1, DigitalOut *bit2, int number) | |
| Creates an IRSensor object. | |
| virtual | ~IRSensor () |
| Deletes the IRSensor object. | |
| float | read () |
| Gets the distance measured with the IR sensor in [m]. | |
| operator float () | |
The empty operator is a shorthand notation of the read() method. | |
Detailed Description
This is a device driver class to read the distance measured with a Sharp IR sensor.
Definition at line 16 of file IRSensor.h.
Constructor & Destructor Documentation
| IRSensor | ( | AnalogIn * | distance, |
| DigitalOut * | bit0, | ||
| DigitalOut * | bit1, | ||
| DigitalOut * | bit2, | ||
| int | number | ||
| ) |
Creates an IRSensor object.
- Parameters:
-
distance an analog input object to read the voltage of the sensor. bit0 a digital output to set the first bit of the multiplexer. bit1 a digital output to set the second bit of the multiplexer. bit2 a digital output to set the third bit of the multiplexer. number the number of the sensor, either 0, 1, 2, 3, 4 or 5.
Definition at line 19 of file IRSensor.cpp.
| ~IRSensor | ( | ) | [virtual] |
Deletes the IRSensor object.
Definition at line 44 of file IRSensor.cpp.
Member Function Documentation
| operator float | ( | ) |
The empty operator is a shorthand notation of the read() method.
Definition at line 63 of file IRSensor.cpp.
| float read | ( | ) |
Gets the distance measured with the IR sensor in [m].
- Returns:
- the distance, given in [m].
Definition at line 50 of file IRSensor.cpp.
Generated on Wed Jul 13 2022 05:37:58 by
1.7.2