Skip to main content

Light Sensor


Introduction​

Features​

Light Sensor: Highly sensitive to light changes, it outputs corresponding signals based on ambient light intensity. In smart lighting systems, it automatically distinguishes between light and dark to turn lights on/off or adjust brightness; in outdoor devices, it can also adjust screen brightness according to light levels, saving energy and protecting eyes.


Specifications​

ItemParameter
NameLight Sensor
SKUEF16005
ConnectionAnalog Output
Input Voltage4.15V
Product Size38.00mm×28.20mm (L×W)

Appearance and Dimensions​


None


Quick Start​

Hardware Connection Diagram​


Usage Tutorials​

Programming Software​

Microsoft MakeCode


MakeCode Programming​

Step 1: Adding the Jacdac Extension​

  1. Go to Microsoft MakeCode and click New Project.

  1. Enter a project name in the pop-up window and click Create.

  1. Click Extensions in the code drawer.

  1. Type "Jacdac" in the search bar, click the magnifying glass icon, and select the Jacdac software library as shown.


Step 2:​

  1. Connect the micro:bit to your computer using a data cable. Note: If this is the first time running a Jacdac program on the micro:bit, preload a blank Jacdac program first. Skip this step if already done.

    Note: Make sure the power selection switch is set correctly. When using the micro:bit board to power the Jacdac modules, set the switch to micro:bit. When using an external power module, set the switch to Power.

  1. Connect the sensor. MakeCode will automatically detect it and simulate the sensor status in the emulator.

  1. Click ADD BLOCKS for the sensor extension module. Note: Repeat this step each time you connect a new sensor.


Program Code​

Reference Program​

Link: https://makecode.microbit.org/_AAALazD9MevC

## Result

When the detected ambient light intensity is < 10, the micro:bit displays "√"; otherwise, it displays "×".