ROME2 Lab3
IRSensor Class Reference
This class implements a driver to read the distance sensors of the ROME2 mobile robot. More...
#include <IRSensor.h>
Public Member Functions | |
| IRSensor (AnalogIn &distance, DigitalOut &bit0, DigitalOut &bit1, DigitalOut &bit2, int number) | |
| Creates and initialises the driver to read the distance sensors. | |
| virtual | ~IRSensor () |
| Deletes this IRSensor object and releases all allocated resources. | |
| float | read () |
| This method reads from the distance sensor. | |
| operator float () | |
The empty operator is a shorthand notation of the read() method. | |
Detailed Description
This class implements a driver to read the distance sensors of the ROME2 mobile robot.
Definition at line 17 of file IRSensor.h.
Constructor & Destructor Documentation
| IRSensor | ( | AnalogIn & | distance, |
| DigitalOut & | bit0, | ||
| DigitalOut & | bit1, | ||
| DigitalOut & | bit2, | ||
| int | number | ||
| ) |
Creates and initialises the driver to read the distance sensors.
- Parameters:
-
distance the analog input to read a distance value from. bit0 a digital output to control the multiplexer. bit1 a digital output to control the multiplexer. bit2 a digital output to control the multiplexer. number the number of the sensor. This value must be between 0 and 5.
Definition at line 20 of file IRSensor.cpp.
| ~IRSensor | ( | ) | [virtual] |
Deletes this IRSensor object and releases all allocated resources.
Definition at line 28 of file IRSensor.cpp.
Member Function Documentation
| operator float | ( | ) |
The empty operator is a shorthand notation of the read() method.
Definition at line 48 of file IRSensor.cpp.
| float read | ( | ) |
This method reads from the distance sensor.
- Returns:
- a distance value, given in [m].
Definition at line 34 of file IRSensor.cpp.
Generated on Wed Jul 13 2022 16:04:31 by
1.7.2