An external light sensor for all your light sensing needs.
The black lead goes on GND, the red lead goes on 3v and the other lead goes on 0, 1, or 2.
This item is polarity sensitive, the red & black leads need to be on the correct connections for increasing light to provide an increasing value. There is no harm caused by incorrect connections.
Use the analog input blocks to read the sensor value:
You can use any one of the three pins 0, 1 or 2.
The value will vary between 0 and 1024 – the full range of the micro:bit analog input. Typical values will be under 200 for dark, 600+ for in view of a light, 950+ when held to a torch or lamp.
This code block example assumes the sense lead is on the connector marked 1. It will show B (for Bright), or D (for Dark) or ? (for in between).