problem is that it's called in interval and there is a high chance that during the day LED may flash in between the checks.
I still want to capture the LED flash, which is done through setWatch.
Yes, that's fine. I should still work - and as far as I understand you tested and it does work?
Why there was pinmode set in the original code before the setWatch? Maybe it's a key to my understanding
As I said above, the pullup is enabled because it's like a 'potential divider'. When the light level is low, LDR resistance is high and the voltage on the pin goes high. When you have light, LDR resistance is low and it pulls the pin voltage low.
But I'm sorry, I'm really busy this week and I can't spend any more time walking you through the code. I think I've already covered what it does line by line in every circumstance
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, that's fine. I should still work - and as far as I understand you tested and it does work?
As I said above, the pullup is enabled because it's like a 'potential divider'. When the light level is low, LDR resistance is high and the voltage on the pin goes high. When you have light, LDR resistance is low and it pulls the pin voltage low.
But I'm sorry, I'm really busy this week and I can't spend any more time walking you through the code. I think I've already covered what it does line by line in every circumstance