Pin 13 LED must light up when there is sufficient darkness in the room ( i.e when I place my palm over it ). The LED on Arduino responds as expected but the LED on bread board doesn't work? How can I make it work?
What exactly are you trying to do? If you want to use an arduino to control the LED, there should be no connection between the photoresistor circuit and the LED circuit, they should be connected to different pins on the arduino. If you are trying to turn the LED ON and OFF solely using the photoresistor, there is no need for the arduino or any code.
I want to turn the LED (the one connected to 13 on the breadboard) to turn ON when I place my palm over the photoresistor, we actually have an inbuilt LED on the Arduino, right, near pin 13, this one glows when I place my palm over the LDR but at the same time, I need the LED on breadboard also to glow, which is not happening.
Why is it that the inbuilt LED responds and the red LED on the breadboard doesn't?
How can you make it happen without a code?
Why do you suggest that the photoresistor circuit and LED circuit must be independent of each other?
sir, I isolated both the circuits, and it worked perfectly. I think the problem was that when the light intensity on LDR decreases, its resistance increases, so the current flow through the circuit decreases, eventually, the current reaching the LED on the breadboard was not enough to light the LED.
Now, the LED is not connected to the same pin as in my schematic.
Not only the current but the voltage. As the LDR increases in resistance, the potential at A0 drops. If this drops below the turn on voltage of the LED, then it can never light the LED.
This turn on voltage is determined by the LED’s colour but it is at least 1.7V and could be up to 3V.
So the criteria to turn on the onboard LED is determined by software and this is not the same as the criteria needed to turn on the external LED which is determined by what voltage is available to turn on the external LED.
Seeing as the signal to turn on the onboard LED appears on pin 13, then you could just connect the external LED and resistor to that and you wouldn’t need any extra software, other than making sure pin 13 is set to be an output in the setup function.