grove grove (GL5528 LDR) Light sensor class
Spaniakos - grove (GL5528 LDR) Light sensor class
Public Member Functions | Private Attributes | List of all members
LightSensor Class Reference

#include <LightSensor.h>

Public Member Functions

 LightSensor (uint8_t pin, int thres)
 LightSensor (uint8_t pin)
void begin (void)
void Read_Light (void)
void Light_To_Lux (void)
void Save_Old (void)
int cmp_values (void)
int Value (void)
int Old_Value (void)
void CalcRensor ()
float get_Rensor ()
int get_Threshold ()
void calibrate ()

Private Attributes

uint8_t pinLight
int LUX
int sensorValue
int Old_LUX
float Rensor
int LightThres

Detailed Description


Constructor & Destructor Documentation

LightSensor::LightSensor ( uint8_t  pin,
int  thres 

class constructor.

pinuint8_t Number of the pin to be used for reading
thresint value of the threshold that will be used
LightSensor::LightSensor ( uint8_t  pin)

class constructor.

Threasold initializes to 1.

pinuint8_t Number of the pin to be used for reading

Member Function Documentation

void LightSensor::begin ( void  )

Initialized the base grove class with the balues given in the constructor.

void LightSensor::Read_Light ( void  )

reads value from sensor. the value is saved to sensorValue

void LightSensor::Light_To_Lux ( void  )

Reads the Value from the pin using

Calculates the Rensor using

end Saves the LUX value.

void LightSensor::Save_Old ( void  )

set Old_LUX equal to current LUX.

int LightSensor::cmp_values ( void  )

compare LUX and OLD_LUX values.

int 0 if equal , 1 if not
int LightSensor::Value ( void  )

Gets the LUX valule.

LUX value.
int LightSensor::Old_Value ( void  )

get the Old_LUX value.

OLD_LUX value.
void LightSensor::CalcRensor ( )

Calculate the Rensor. The value is saved inside the class.

float LightSensor::get_Rensor ( )

GETS the Rensor value.

Rensor value.
int LightSensor::get_Threshold ( )

Gets the Threshold.

LightThres as integer
void LightSensor::calibrate ( )

calibrate the sensor and readings. Does initial readings in order to calibrate the sensor.

Member Data Documentation

uint8_t LightSensor::pinLight

holds the Pin number of the board

int LightSensor::LUX

holds the LUX value after the convertion from te reading

int LightSensor::sensorValue

holds the reading value from the sensor

int LightSensor::Old_LUX

holds the old LUX value, mainly used from cmp_values

float LightSensor::Rensor

holds the rensor value

int LightSensor::LightThres

hold the Threshold, mainly used from cmp_values