The FLORA, FLORA BLE module, and FLORA light sensor are wired up as pictured:
Required Arduino libraries:
- Adafruit Unified Sensor Library
- Adafruit TSL2561 Light Sensor Library
- Adafruit Bluefruit LE nRF51 Library
Download and unzip the following file, then open up light-logging-hat.ino in your Arduino IDE:
The main loop of the code reads the light sensor and sends the value out over the bluetooth connection:
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
tsl.getEvent(&event);
/* Display the results (light is measured in lux) */
if (event.light)
{
ble.println(event.light);
}
else
{
/* If event.light = 0 lux the sensor is probably saturated
and no reliable data could be generated! */
Serial.println("Sensor overload");
}
delay(1000);
}
Page last edited September 30, 2015
Text editor powered by tinymce.