upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the Grove Light Sensor. More...

Detailed Description

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 greater in bright light and smaller in the dark. An approximate lux value can also be returned.

while (true) {
float raw_value = gl.raw_value();
float value = gl.value();
System.out.println("raw value: " + raw_value);
System.out.println("value: " + value);
Thread.sleep(1000);
}
grovelight.jpg

Public Member Functions

synchronized void delete ()
 
 GroveLight (long pin)
 
float raw_value ()
 
int value ()
 
- Public Member Functions inherited from Grove
synchronized void delete ()
 
String name ()
 

Constructor & Destructor Documentation

GroveLight ( long  pin)

Grove analog light sensor constructor

Parameters
pinAnalog pin to use

Member Function Documentation

float raw_value ( )

Gets the raw value from the AIO pin

Returns
Raw value from the ADC
int value ( )

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

Returns
Normalized light reading in lux
Inheritance diagram for GroveLight:
Inheritance graph
[legend]
Collaboration diagram for GroveLight:
Collaboration graph
[legend]

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