Develop an interfacing circuit and a sketch for intruder alert system that uses PIR sensor and GSM modem. Upon intruder detection send SMS – “Alert : Intruder detected”. Repeat the same at 10 second interval till a reset button is pressed.
Here i am using online IDE Tinkercad . If you don't know what is tinkercad then refer my blog HERE or else you can use offline IDE also.
Code:-
void
setup() {
pinMode(2, INPUT); //Pin 2 as INPUT
pinMode(3, OUTPUT); //PIN 3 as OUTPUT
}
void
loop() {
if (digitalRead(2) == HIGH)
{
digitalWrite(3, HIGH); // turn the LED/Buzz ON
delay(100); // wait for 100 msecond
digitalWrite(3, LOW); // turn the LED/Buzz OFF
delay(100); // wait for 100 msecond
}
}
Output:-
Comments
Post a Comment