Light Sensor

Light Sensor Light Sensor

The light sensor is a tiny solar cell. It produces electrical current from light. The more light that is hitting the sensor, the more current it makes. Arduino can measure this current and then calculate how much light the sensor is being exposed to.

Main Function

awesome.lightSensor.reading()

Gets a light reading from the light sensor.

Returns

It returns an int, which is the light level between 0-1023. A higher reading means the sensor sees more light, and a lower reading means less light.

Example

// Turns the LED on if light level is greater than 500 if ( awesome.lightSensor.reading() > 500 ) { awesome.LED.turnOn(); }

Advanced Function

awesome.lightSensor.print()

First it takes a reading from the light sensor. Then it sends a message including this reading over the Serial connection.

Click the magnifying glass icon in the top right hand corner of the Arduino IDE to see the messages that Arduino sends to your computer through the Serial connection.

Example

// print a light sensor reading to the Serial connection awesome.lightSensor.print();

Tips

The sensor reading changes if you cover it with your hand, or shine a light on it. You can use the light sensor to detect a simple gesture: a hand passing over it.

x

Hi awesome backer,

Thanks again for supporting us on Kickstarter or Indiegogo.

On this website you can access the learning videos and documentation. You'll need to sign up for an account but it shouldn't take long and allows us to remember your video progress so you don't have to keep track of that.

We hope you have a great time learning with Awesome Shield.


Close Message