Light Sensor¶

Description |
The photocell is used to measure the amount of ambient light. Many uses such as smoke detection, solar monitoring, and light dimming. |
Usage |
Reads a raw analog light value as a variable resistance. With micro:bit ADC input this would range from 0 to 1023. |
Voltage Range |
0 - 5V |
Interface Type |
Analog Input |
Example Usage |
from microbit import *
while True:
photo_val = pin0.read_analog()
if photo_val > 200:
# bright light sensed
# ...do something
else:
# it is very dark
# ...do something
|