Pages: [1]   Go Down
Author Topic: LDR circuit  (Read 1149 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

https://gist.github.com/3720060

Hey, according to this coding, this is a night lamp circuit. So I am curious about one thing. LDR is an analog sensor. So, the light intensity of the LED at pin 13 will change according to the light intensity received by the LDR. But then according to this coding, it is either a sharp 5V HIGH for the LED at pin 13 or a LOW for the LED. If the sensovalue is <150, which means dark ,so the LED will light up with 5V. But when I play with it, the light intensity of the LED is various with the LDR. So this make me do not understand fully about the coding @@ Can anyone clarify for me ?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25768
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If the sensovalue is <150,
That's not what the code says.

Why don't you post your code and the serial output?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Erm, sorry .. My code is <400..Typo..

So how to explain the thing ?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25768
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Explain what thing?
What do you mean by 'play with it'?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Means I various with the light intensity. Hahahaha..

Explain why the light intensity of the LED will affected by the intensity of light o LDR. I suppose it to be either HIGH or LOW...no intermediate. But when I vary the light intensity, the LED light up abit and when totally <400, the LED is fully light up
Logged

Offline Offline
Sr. Member
****
Karma: 6
Posts: 427
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

LDR = Light Sensitive Resistor, at a certain light resistance level the sketch turns the LED on.

You could change the LDR for a potentiometer and load the example sketch  AnalogReadSerial to see what happens.

The Analog Input is another example sketch which shows how to use analogin to change the blink rate of the LED.

In the Arduino IDE goto File - Examples - Basics - AnalogReadSerial for the first example
and File - Examples - Analog - AnalogInput for the second example.

In your case it sounds like the LED is being switched on and off very quickly, which should not happen, replace the LDR with a POT and see how that affects the LED.
Logged

Pages: [1]   Go Up
Jump to: