Wednesday, December 2, 2015

Measuring the Light (Luminosity)

In this challenge we had to have to get a special chip that didn’t come in the Sunfounder kit, but we do have on hand. We then clicked this link http://adafru.it/d7d to install the AdaFruit Library. After that we had to unzip it, copy the Folder and then find the Arduino library on our hard drive and paste it into the Library Folder there. We also needed the Adafruit Sensor Library.When completed we downloaded the Adafruit_Sensor Library then copied and pasted the folder into our Aquino's library folder like you did above. When completed we restarted the Arduino IDE. Now we could run the File->Examples->Adafruit_TSL2561->sensorapi example program which read and calculate the lux readings for us. Lastly we took a look at the program. To see the readings Ruth and I had clicked on the little magnifying glass at the top of the Arduino window to open the Serial Monitor. We then used code
{  
 sensors_event_t event;
 tsl.getEvent(&event);
 if (event.light)
 {
   Serial.print(event.light); Serial.println(" lux");
 }
 else
 {
      Serial.println("Sensor overload");
 }
 delay(250);

}

This code was recursive and just keeps calling itself over and over
The last code being used was:
Serial.print(event.light);

which prints out the luminosity value.