1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| #include <Servo.h>
Servo myservo;
int botrightpin = 5;
int botleftpin = 6;
int toprightpin = 9;
int topleftpin = 10;
int servopin = 11;
int val=0;
int buzzPin = 3;
void setup()
{
pinMode(botleftpin, OUTPUT);
pinMode(botrightpin, OUTPUT);
pinMode(topleftpin, OUTPUT);
pinMode(toprightpin, OUTPUT);
pinMode(buzzPin, OUTPUT);
myservo.attach(servopin);
Serial.begin(9600);
}
void loop()
{
digitalWrite(botleftpin, HIGH);
digitalWrite(botrightpin, HIGH);
digitalWrite(topleftpin, HIGH);
digitalWrite(toprightpin, HIGH);
delay(7000);
digitalWrite(botleftpin, LOW);
digitalWrite(botrightpin, LOW);
digitalWrite(topleftpin, LOW);
digitalWrite(toprightpin, LOW);
myservo.write(90);
digitalWrite(buzzPin, HIGH);
delay(200);
myservo.write(0);
digitalWrite(buzzPin, LOW);
delay(2000);
}
|