upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for the Grove Light Sensor. More...

Detailed Description

This class is being replaced by the upm-light library and the Light class.

The Grove light sensor detects the intensity of the ambient light. As the light intensity of the environment increases, the resistance of the sensor decreases. This means the raw value from the analog pin is larger in bright light and smaller in the dark. An approximate lux value can also be returned.

// Create the light sensor object using AIO pin 0
upm::GroveLight light(0);
// Read the input and print both the raw value and a rough lux value,
// waiting one second between readings
while (1) {
std::cout << light.name() << " raw value is " << light.raw_value() << ", which is roughly "
<< light.value() << " lux" << std::endl;
// Delete the light sensor object

Public Member Functions

 GroveLight (unsigned int pin)
 ~GroveLight ()
float raw_value ()
int value ()
- Public Member Functions inherited from Grove
std::string name ()

Additional Inherited Members

- Protected Attributes inherited from Grove
std::string m_name

Constructor & Destructor Documentation

GroveLight ( unsigned int  pin)

Grove analog light sensor constructor

pinAnalog pin to use
~GroveLight ( )

GroveLight destructor

Member Function Documentation

float raw_value ( )

Gets the raw value from the AIO pin

Raw value from the ADC
int value ( )

Gets an approximate light value, in lux, from the sensor

Normalized light reading in lux
Inheritance diagram for GroveLight:
Inheritance graph
Collaboration diagram for GroveLight:
Collaboration graph

The documentation for this class was generated from the following files: