Engduino v2.1
EngduinoLight.cpp
Go to the documentation of this file.
00001 /**
00002 * \addtogroup EngduinoLight
00003 *
00004 * This is the driver code for Light on the Engduino
00005 * In v2.1 this magnetometer is a Avago ADPS-9008
00006 *
00007 * @{
00008 */
00009 
00010 /**
00011 * \file 
00012 *               Engduino Light Sensor driver
00013 * \author
00014 *               Engduino team: support@engduino.org
00015 */
00016 
00017 #include "pins_arduino.h"
00018 #include "EngduinoLight.h"
00019 
00020 /*---------------------------------------------------------------------------*/
00021 /**
00022 * \brief Constructor
00023 * 
00024 * C++ constructor for this class. Empty.
00025 */
00026 EngduinoLightClass::EngduinoLightClass()
00027 {
00028 }
00029 
00030 /*---------------------------------------------------------------------------*/
00031 /**
00032 * \brief begin function - must be called before using other functions
00033 *
00034 * Does nothing in this case
00035 */
00036 void EngduinoLightClass::begin() 
00037 {       
00038 }
00039 
00040 /*---------------------------------------------------------------------------*/
00041 /**
00042 * \brief end function - switch off the light sensor
00043 *
00044 * Does nothing in this case
00045 */
00046 void EngduinoLightClass::end() 
00047 {       
00048 }
00049 
00050 /*---------------------------------------------------------------------------*/
00051 /**
00052 * \brief lightLevel function - returns light level (10 bit value)
00053 *
00054 * This function returns the light level. Since the input is an analogue one
00055 * and the ADC gives a 10 bit value, it returns a 16 bit integer.
00056 *  
00057 */
00058 uint16_t EngduinoLightClass::lightLevel() 
00059 {       
00060         return analogRead(LIGHTSENSOR);
00061 }
00062 
00063 /*---------------------------------------------------------------------------*/
00064 /*
00065  * Preinstantiate Objects
00066  */ 
00067 EngduinoLightClass EngduinoLight = EngduinoLightClass();
00068 
00069 /** @} */