Micro:Bit light sensor help needed

very simple code not working properly. when in light it just flashes and doesn’t stay on. i just want it to stay on when in darkness and off when not.
image

Hi

Is this more like what you wanted?

the “light level” block can be u from 1 to 255.so putting in image wouldn’t make sense.

Hi

My mistake i apologise for misreading your original question

The problem lies . i think with the way that the Micro:Bit uses the actual LED display to measure the light level?

  1. As soon as the LED panel turns on, the Micro:Bit will detect the light from the LEDs & turn off the panel,

2)But as soon as this happens the micro:Bit will detect darkness & so turn on the Panel … so back to step 1

At the moment the only way i can think of solving this easily is to use either a separate light sensor ( shielded from the Micro:Bit Panel so it does not detect this being turned on ) OR as separate LED output ( which you will need to shield the Micro:Bit from)

Alternatively you could use 2 Micro:Bits ( 1 to detect light level in the room , 1 to output light) . The 1st Micro:Bit can send command via Radio to 2nd to turn on or off. Again you would have to shield the 1st micro:Bit so that the light from the 2nd does not cause it to send a turn off command

Again please accept my apologies

1 Like

thank you, this helped a lot!

Hi
Glad to have been of some help .

How are you / did you solve the problem in the end …

Always good to share solutions as others are probably having the same difficulty.

TTFN