Hi, i have now this code, and i want to put the LED 5 seconds on when the led is triggered.
when i add a delay(5000); code. it affact the whole code. how can i use the delay fuction only for the LED?
if (ldrwaarde2 == ldrwaarde ){
lcd.setCursor(9,1);
lcd.print("Gelijk!");
digitalWrite(53, HIGH);
[b]delay(5000);[/b]
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int ldr =9;
int waarde;
int potMeter =15;
int ldrwaarde;
int licht =12;
int ldrwaarde2;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(53, OUTPUT);
}
void loop() {
ldrwaarde = analogRead(ldr);
lcd.setCursor(0,0);
lcd.print("LWS:");
lcd.setCursor(4,0);
lcd.print(ldrwaarde);
waarde = analogRead(potMeter);
lcd.setCursor(0,1);
lcd.print("Pot:");
lcd.setCursor(4,1);
lcd.print(waarde);
ldrwaarde2 = analogRead(licht);
lcd.setCursor(8,0);
lcd.print("LWS2:");
lcd.setCursor(13,0);
lcd.print(ldrwaarde2);
if (ldrwaarde2 == ldrwaarde ){
lcd.setCursor(9,1);
lcd.print("Gelijk!");
digitalWrite(53, HIGH);
}
else{
lcd.setCursor(10,1);
lcd.print("...");
digitalWrite(53, LOW);
}
delay(450);
lcd.clear();
}