-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCode.txt
More file actions
59 lines (55 loc) · 1.15 KB
/
Copy pathCode.txt
File metadata and controls
59 lines (55 loc) · 1.15 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<Servo.h>
# define IR_gate D1
# define led D2
# define IR_key A0
# define vibration D0
# define pir D6
Servo s;
void setup() {
// put your setup code here, to run once:
pinMode(IR_gate,INPUT);
pinMode(IR_key,INPUT);
pinMode(vibration,INPUT);
pinMode(led,OUTPUT);
s.attach(2);
digitalWrite(led,LOW);
Serial.begin(9600);
s.write(0);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(IR_gate)==HIGH)
{
digitalWrite(led,HIGH);
Serial.println("gate closed");
delay(500);
}
else if(digitalRead(IR_gate)==LOW)
{
digitalWrite(led,LOW);
delay(100);
}
if(analogRead(IR_key)>600)
{
s.write(90);
Serial.println("ATM IS BEING RAIDED\\IR key");
// Serial.write("ATM IS BEING RAIDED\\IR key");
delay(5000);
}
if(digitalRead(vibration)==LOW)
{
s.write(90);
//Serial.write("ATM IS BEING RAIDED\\vibration");
Serial.println("ATM IS BEING RAIDED\\vibration");
delay(5000);
}
if(digitalRead(pir)==HIGH)
{
//Serial.write("ATM IS BEING RAIDED\\pIR ");
s.write(90);
Serial.println("ATM IS BEING RAIDED\\pIR ");
delay(2000);
}
digitalWrite(led,LOW);
s.write(0);
}