Introducing Delay in Blinking LED
Introducing delay in the blinking of the LED by exposing it to light
Here the input as well as out is through the Arduino board.
The photoresistor was used to control the frequency of blink of the LEDs
and with the exposure of light the frequency decreases i.e, the LED blinks
slowly and vice versa.
Code for Arduino IDE
int potPin = 2;
int ledPin = 13;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
val = analogRead(potPin);
digitalWrite(ledPin, HIGH);
delay(val);
digitalWrite(ledPin, LOW);
delay(val);
}
page revision: 1, last edited: 06 Sep 2008 08:28