11 years, 10 months ago.

LDR sensor

Hi there

Could please help me out? I dont know what's wrong with this? It is my code or connections. Can u check please?

/media/uploads/brunojkav/--------_2013-11-23_13.17.08.png /media/uploads/brunojkav/2013-11-23_13.14.32.jpg /media/uploads/brunojkav/2013-11-23_13.14.27.jpg /media/uploads/brunojkav/2013-11-23_13.14.23.jpg /media/uploads/brunojkav/2013-11-23_13.14.12.jpg

2 Answers

11 years, 10 months ago.

First of all, just copy past code here between <<code>> and <</code>>, thats easier than screenshots.

Next AnalogIn returns a value between 0 and 1, checking if it is larger than 800 is an easy answer: no. I would simply send the read value back to your PC via serial connection. Use printf with %f (since AnalogIn returns a float), and look at the value you get. Then you see if it is working properly and with how much you should compare it.

11 years, 10 months ago.

Make sure that the 3V3 and GND powerbus is actually connected through. Many breadboards dont have full connectivity between all the 5pin sections. Some have a continuous red and blue line showing that they are indeed connected through.

You wont get any reading back from the LDR when the connection is missing on your breadboard since the LDR/Resistor divider receives no power.

/media/uploads/wim/2013-11-23_13.14.23a.jpg