In our industry we required a on time delay after pressing switch the action should start after some time, I am beginner with arduino but I could not able to find it on internet. So I am writing here on time delay circuit and program.
Arduino Program for On Time Delay
const int LED2 = 12; const int BUTTON = 7; //----------------------------------------- void setup() { pinMode (LED2,OUTPUT); pinMode (BUTTON,INPUT); } //----------------------------------------- void loop(){ int val = digitalRead(BUTTON); if (val == HIGH) { delay(4000); digitalWrite(LED2,HIGH); delay (2000); digitalWrite(LED2,LOW); } } //-----------------------------------------
It works perfectly for my application.
Responses