//1sheeld.com for the steps on adding the libraries to your arduino program
#include <OneSheeld.h>
int ledPin = 13; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for PIR sensor)
int PIR = LOW;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input
OneSheeld.begin();
}
void loop(){
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
delay(150);
if (PIR == LOW) {
SMS.send("0123456789","Motion DETECTED"); // change number with your own here
PIR = HIGH;
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
if (PIR== HIGH){
PIR = LOW;
}
}
}
Comments
Please log in or sign up to comment.