#๐Ÿ”’ Need help changing code so my ldr turns my led off when its not dark but turns on when it is dark

22 messages ยท Page 1 of 1 (latest)

graceful caveBOT
#

@blissful niche

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

proper mauve
#

Are you getting errors? Or what specifically is not working?
I notice that there is no such thing as rgb.value and I dont think you need the rgb.value = ldr.value line all together

blissful niche
proper mauve
blissful niche
proper mauve
#

You could add a print statement to see what the ldr is currently reading

blissful niche
#

the ldr value says its reading 0.00

proper mauve
#

Does it change when the light changes?

blissful niche
#

No, doesnt change

#

could it be something wrong with my wiring?

proper mauve
#

I think you might need to check the wiring

#

Make sure it is actually in Pin 27 and one lead has 5v power

blissful niche
#

ok

proper mauve
#

And that pin 27 is an analog pin

blissful niche
#

o

blissful niche
proper mauve
#

now you just need to measure what it reads when it is light and when it is dark and pick a value in between to replace 0.4

blissful niche
#

thanks

graceful caveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Need help changing code so my ldr turns my led off when its not dark but turns on when it is dark