Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

playground Learning PhotoResistor [imported]

Open cmaglie opened this issue 14 years ago • 1 comments

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?

  1. take the code from http://www.arduino.cc/playground/Learning/PhotoResistor
  2. Put it in arduino
  3. 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 ;)

cmaglie avatar Nov 15 '12 19:11 cmaglie

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.

shfitz avatar Apr 01 '13 15:04 shfitz