Skip to content

Commit 9766f96

Browse files
authored
Add files via upload
1 parent 222a0a6 commit 9766f96

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
int Status = 12;
3+
int sensor = 13;
4+
5+
void setup() {
6+
pinMode(sensor, INPUT); // declare sensor as input
7+
pinMode(Status, OUTPUT); // declare LED as output
8+
}
9+
10+
void loop(){
11+
long state = digitalRead(sensor);
12+
delay(1000);
13+
if(state == HIGH){
14+
digitalWrite (Status, HIGH);
15+
Serial.println("Motion detected!");
16+
}
17+
else {
18+
digitalWrite (Status, LOW);
19+
Serial.println("Motion absent!");
20+
}
21+
}

0 commit comments

Comments
 (0)