Motion detection and SMS Arduino Uno

Hello my name is Jack and i'm quit new with Arduino.

I'm trying to make a motion alarm that will send an SMS when it detects movement.

If found a few sketches on YouTube but not the one i'm looking for.
Only alarm or only SMS or to complicated.
Maybe it's already on the forum but i couldn't find it..

Im using the 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 is the code i'm building:

#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 was turned ");
 Serial.println(state ? "on" : "off");
 
 GPRS.println("AT+CMGS=\"+630699542\"");
 
 delay(500);
 
 GPRS.print("Switch was 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 this error:

exit status 1
'checkPIR' was not declared in this scope

Can someone help me with fixing this code?

Thank for the effort

Have you made each part work on its own?

(deleted)

The sms module was working and the PIR also but putting them together is a disaster for me.

How do I need to post it??

I'm new to this forum

(deleted)

(deleted)

veenj3:
How do I need to post it??

Instructions in this thread at the top of every forum.
How to use this forum - please read.

I used the code tag now.

The's an } before void sendSMS()

Can someone fil in the gaps of the code?

(deleted)

Thanks for helping me.

gr