Previous

This is the 17th example in a series of examples for arduino beginners. For more examples click these buttons or select a example from the grid at the bottom.

Next

Description

In this 17th example in our arduino for beginners examples, we use a LDR to gauge the ambient light intensity and control the brightness of a LED accordingly. The idea is to use ADC and PWM DAC together in a example.

Code

int ledPin = 13;
void setup() {
pinMode(ledPin,OUTPUT);
}
void loop() {
int sensorValue = analogRead(A0);
analogWrite(ledPin, sensorValue);
delay(1);
}

Pictures / Video

Arduino For Beginners - LDR Light Controller
Arduino For Beginners - LDR Light Controller
Arduino For Beginners - LDR Light Controller

Files

Arduino SketchFritzing File

Share This

Other Examples

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

Other Learning Resources