ecrobot::LightSensor Class Reference
NXT Light sensor class.
More...
#include <LightSensor.h>
List of all members.
Public Member Functions |
| LightSensor (ePortS port, bool lamp=true) |
| Constructor (turn on the lamp by default).
|
| ~LightSensor (void) |
| Destructor (turn off the lamp if it was on).
|
S16 | getBrightness (void) const |
| Get brightness.
|
void | setLamp (bool lamp) |
| Turn on/off the lamp.
|
S16 | get (void) const |
| Get raw A/D value.
|
Protected Member Functions |
ePortS | getPort (void) const |
| Get the sensor connected port.
|
Detailed Description
NXT Light sensor class.
Constructor & Destructor Documentation
ecrobot::LightSensor::LightSensor |
( |
ePortS |
port, |
|
|
bool |
lamp = true | |
|
) |
| | [explicit] |
Constructor (turn on the lamp by default).
Note:
This class must be constructed as a global object. Otherwise, a device assertion will be displayed
in the LCD when the object is constructed as a non global object.
When the object is destructed while the system is shut down, the device is de-activated automatically.
- Parameters:
-
| port | Light sensor connected port |
| lamp | Turn on/off the lamp (true:on/false:off) |
- Returns:
- -
ecrobot::LightSensor::~LightSensor |
( |
void |
|
) |
|
Destructor (turn off the lamp if it was on).
- Parameters:
-
- Returns:
- -
Member Function Documentation
S16 ecrobot::Sensor::get |
( |
void |
|
) |
const [inline, inherited] |
Get raw A/D value.
- Parameters:
-
- Returns:
- raw A/D value (0 to 1023)
S16 ecrobot::LightSensor::getBrightness |
( |
void |
|
) |
const |
Get brightness.
- Parameters:
-
- Returns:
- Brightness value (greater value means brighter)
ePortS ecrobot::Sensor::getPort |
( |
void |
|
) |
const [inline, protected, inherited] |
Get the sensor connected port.
- Parameters:
-
- Returns:
- Sensor connected port
void ecrobot::LightSensor::setLamp |
( |
bool |
lamp |
) |
|
Turn on/off the lamp.
- Parameters:
-
- Returns:
- -
The documentation for this class was generated from the following file: