LoRaWAN demo.

Dependencies:   modem_ref_helper DebouncedInterrupt

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sensor.cpp Source File

sensor.cpp

00001 #include "mbed.h"
00002 #include "hwcfg.h"
00003 #include "sensor.h"
00004 #include "WizziDebug.h"
00005 
00006 
00007 #if defined(SENSOR_LIGHT_MEAS) && defined(SENSOR_LIGHT_EN)
00008 
00009 AnalogIn g_light_meas(SENSOR_LIGHT_MEAS);
00010 DigitalOut g_light_en_l(SENSOR_LIGHT_EN);
00011 
00012 
00013 light_value_t sensor_get_light(void)
00014 {
00015     light_value_t light_level = 0;
00016     
00017     // Enable light sensor
00018     g_light_en_l = 0;
00019     
00020     Thread::wait(10);
00021     
00022     // Read light value
00023     light_level = (light_value_t)(1000*g_light_meas);
00024     
00025     // Disable light sensor
00026     g_light_en_l = 1;
00027     
00028     return light_level;
00029 }
00030 #else
00031     #error Please define some sensor
00032 #endif