Motion detection and SMS Arduino Uno
hello name jack , i'm quit new arduino.
i'm trying make motion alarm send sms when detects movement.
if found few sketches on youtube not 1 i'm looking for.
only alarm or sms or complicated.
maybe it's on forum couldn't find it..
im using following parts:
- arduino uno
- sim800l
- pir sensor
my pins are:
pir = pin 4
testled = pin 6
testswitch = pin 5
tx = pin 2
rx = pin 3
this code i'm building:
i'm getting error:
exit status 1
'checkpir' not declared in scope
can me fixing code?
thank effort
i'm trying make motion alarm send sms when detects movement.
if found few sketches on youtube not 1 i'm looking for.
only alarm or sms or complicated.
maybe it's on forum couldn't find it..
im using following parts:
- arduino uno
- sim800l
- pir sensor
my pins are:
pir = pin 4
testled = pin 6
testswitch = pin 5
tx = pin 2
rx = pin 3
this code i'm building:
code: [select]
#include <softwareserial.h>
#include "timer.h"
const int testswitch = 5;
const int testled = 6;
const int pir = 4;
softwareserial gprs(2, 3);
boolean state, laststate;
int count;
timer t;
void setup(){
int checkevent = t.every(6000,checkpir);
int clearevent = t.every(18000,clearpir);
pinmode(testswitch, input);
pinmode(testled, output);
pinmode(pir, input);
digitalwrite(testled, low);
pinmode(2, output);
gprs.begin(9600);
serial.begin(9600);
gprs.println("at+cmgf=1");
delay(1000);
count=0;
}
void loop()
{
if (digitalread(testswitch) == high){
if (digitalread(pir) == high){
digitalwrite(testled,high);}
else{
digitalwrite(testled,low);}}
if (digitalread(testswitch) == low){
digitalwrite(testled, low);
delay(10000);
digitalwrite(testled, high);
delay(500);
digitalwrite(testled, low);
delay(10000);
digitalwrite(testled, high);
delay(500);
digitalwrite(testled,low);
delay(500);
digitalwrite(testled, high);
delay(500);
digitalwrite(testled, low);
while (count < 2){
t.update();}
digitalwrite(2, low);
delay(1000);
digitalwrite(2, high);
delay(20000);
}
void sendsms() {
serial.print("switch turned ");
serial.println(state ? "on" : "off");
gprs.println("at+cmgs=\"+630699542\"");
delay(500);
gprs.print("switch turned ");
gprs.println(state ? "on" : "off");
gprs.write( 0x1a ); // ctrl+z character
delay(1800000);
}
void checkpir(){
if (digitalread(pir) == high){
count=count+1;}}
void clearpir(){
if (count >=2){}
else{ count=0;}}[/i]
i'm getting error:
exit status 1
'checkpir' not declared in scope
can me fixing code?
thank effort
have made each part work on own?
Arduino Forum > Using Arduino > Programming Questions > Motion detection and SMS Arduino Uno
arduino
Comments
Post a Comment