Input: Light Sensor - 图1

What Is It

The light sensor measures the visible light intensity so that you can know how dark or bright the environment is.

How It Works

The light sensor can convert detected ambient light into electrical output in the circuit. The electrical output is then transformed into a digital signal in a microcontroller. After processing the data, the microcontroller is able to calculate the light intensity (unit: lux ). So we will know the environment is bright or dark by comparing the intensity with a specified value. If it is below this value, we know this is a dark environment and the intensity is regarded as a low threshold; if it is above the value, then we know the environment is sufficient with light and the intensity is regarded as a high threshold.
Try using the low/high threshold to trigger events, e.g. turning on the buzzer when there is no light, and turning it off when light beams down on it.

Real World Analogy

Human eyes, camera

Codecraft

You can find blocks that control the light sensor in the tab Sensing in Codecraft.