The Light Sensor Module provides a very simple analog output, so all you need to connect it to your Arduino or compatible board such as the Eleven is GND, 5V, and one analog input. It accepts a power source (VCC) between 3.0 and 5.5Vdc.

You can use whichever analog input suits you best, but for this example we'll use A0:


That's it! Couldn't be much easier.

The code is very simple as well. Just perform an "analogRead()" call on the appropriate input to get a value between 0 and 1023 that represents the light level being detected. Copy and paste the following code into a new sketch in the Arduino IDE, compile it, upload it to your Arduino, and then open the serial monitor with the baud rate set to 38,400bps:

int lightLevel; 

void setup()
{
  Serial.begin(38400);
}

void loop() 
{
  lightLevel = analogRead(A0);
  Serial.println(lightLevel, DEC);
  delay(200);
}

The light level will be reported five times per second via the serial console.