Circuit and Arduino code

The FLORA, FLORA BLE module, and FLORA light sensor are wired up as pictured:

Required Arduino libraries:

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:

Download: file
void loop(void)
   /* Get a new sensor event */ 
  sensors_event_t event;
  /* Display the results (light is measured in lux) */
  if (event.light)
    /* If event.light = 0 lux the sensor is probably saturated
       and no reliable data could be generated! */
    Serial.println("Sensor overload");

This guide was first published on Sep 30, 2015. It was last updated on Sep 30, 2015.
This page (Circuit and Arduino code) was last updated on Jun 04, 2020.