You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • That's quite a fun problem :)

    A reed switch would be better for some other reasons:

    • What happens if you open the Wardrobe when it's dark?
    • It also allows Espruino to 'sleep', and to wake only when the reed switch changes state. At the moment it'll be having to check the photoresistor every so often, which means it'll be using more power. If you're not running off a battery maybe you don't care though (and if you are you may find that the LED strips draw a bit of power even when off)

    That's not to say the photoresistor can't be made to work though...

    What about:

    • Put the photoresistor in a small cylinder (a cut up biro?) that faces the door. That way when the door is closed, light from the LEDs shouldn't make it think it's light outside.
    • Check for two separate values for when the lights turn on, and when they turn off - and make sure the lights turn off when there's more light than when they turn on, to take account of the fact that the LEDs are lit up (you'd have to add a delay to give the LEDs time to light up before you turn them off though :).
About

Avatar for Gordon @Gordon started