IoT-Labs/Coursework/io.h

20 lines
385 B
C

#ifndef _IO_GUARD
#define _IO_GUARD
#include "dev/light-sensor.h"
#include "dev/leds.h"
// get float from light sensor including transfer function
float
getLight(void)
{
int lightData = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC);
float V_sensor = 1.5 * lightData / 4096;
float I = V_sensor/1e5;
float light = 0.625 * 1e6 * I * 1000;
return light;
}
#endif