playground Learning PhotoResistor [imported]
This is Issue 1100 moved from a Google Code project. Added by 2012-11-05T22:47:15.000Z by [email protected]. Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
What steps will reproduce the problem?
- take the code from http://www.arduino.cc/playground/Learning/PhotoResistor
- Put it in arduino
- led didn't works
What is the expected output? What do you see instead?
Led 11 bright when we have light, but it didn't works
Please provide any additional information below.
The solution is change
analogWrite(ledPin, analogRead(lightPin)/4); to digitalWrite(ledPin, analogRead(lightPin)/4);
and better pin13 ;)
Not sure I see the issue with the code on the playground. Digital pin 11 is a PWM pin. Changing it to digitalWrite will just turn the LED on all the time.