nt LED1=5;
int LED2=6;
int LED3=7;
int IR1 = 2;
void setup() {
// put your setup code here, to run once:
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
pinMode(LED3,OUTPUT);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(IR1, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.begin(9600);
int Button1 = digitalRead(11);
int Button2 = digitalRead(9);
int Button3 = digitalRead(8);
int Button4 = digitalRead(IR1);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
delay(500);
if(Button1 == LOW)
{
digitalWrite(LED1,HIGH);
delay(1000);
digitalWrite(LED1,LOW);
delay(1000);
Serial.print(" azan ");
}
else if(Button2 == LOW)
{
digitalWrite(LED2,HIGH);
delay(1000);
digitalWrite(LED2,LOW);
delay(1000);
}
else if(Button3 == LOW)
{
digitalWrite(LED3,HIGH);
delay(1000);
digitalWrite(LED3,LOW);
delay(1000);
}
else if(Button4 == LOW)
{
digitalWrite(LED3,HIGH);
digitalWrite(LED1,HIGH);
delay(1000);
}
else
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,HIGH);
delay(500);
}
}
No comments:
Post a Comment