// libraries
#include <GSM.h>
// PIN Number
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSMVoiceCall vcs;
char numtel[20]; // buffer for the incoming call
void setup()
{
pinMode(4,OUTPUT);//BARGH MOTOR
pinMode(7,OUTPUT);//FELASHER
pinMode(8,OUTPUT);//ALARM
pinMode(12,OUTPUT);
pinMode(A0,INPUT);//voltag sensor
float v;
// initialize serial communications
Serial.begin(9600);
Serial.println("Receive Voice Call");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
// This makes sure the modem notifies correctly incoming events
vcs.hangCall();
Serial.println("Waiting Call");
}
float vol(int x)
{
float a;
a=analogRead(A0)*(25/1024.0)
return a;
}
void loop()
{ if(a==1)
digitalWrite(4,LOW);//(نرمال قطع)یرق موتور
for(int i=0;i<3;i++)
{ digitalWrite(7, HIGH);
delay(500);
digitalWrite(7, LOW);
delay(500);
}
if(vol(1)<12)
// send sms and voltage=vol*
while(a==1)
if(0<sheak<=0.5)*
for(int i=0;i<3;i++)
{ digitalWrite(7, HIGH);digitalWrite(8, HIGH);
delay(500);
digitalWrite(7, LOW);digitalWrite(8, HIGH);
delay(500);
}
send sms low toucj=h of motor;*
else if(sheak>0.5 , motor is on)*
pin4(high);
call;
while(high)
send locatin per 5 min;
pin6(high);
` delay (500);
pin6(low);
delay (500);
if (sms,remot biseda,a=0)// اگر از سطح 1 خارج شد یقنی یجای بی صدا دزدیر درحالت رانندگی درامد باید از تمام حلقه ها خارج شود باید ابتدا پین 4,6 مفدارش 0 شود
pin4,(low)
pin6(high);
` delay (2000);
pin6(low);
sms 'alarm,location oof and go to a=1'
break
else
چک کردن a و تغییر مقدار آن درصورن لزوم
با اس ام اس و ریموت
چک کردن سطح باتری
while(a==2)
if(0<sheak<=0.5)
send sms low toucj=h of motor;
else if(sheak>0.5)
call;
while(high)
if (pin1==high)
pin4(high)
sms 'motor is turn on (time?)'
send locatin per 5 min;
if (sms,remot biseda,a=0)// اگر از سطح 1 خارج شد یقنی یجای بی صدا دزدیر درحالت رانندگی درامد باید از تمام حلقه ها خارج شود باید ابتدا پین 4,6 مفدارش 0 شود
pin4(low)
sms 'location oof and go to a=2'
break
else
چک کردن a و تغییر مقدار آن درصورن لزوم
با اس ام اس و ریموت
if(a==3) // دزدگیر غیر فعال
pin4(low)
pin1(low)//برق موتور
pin6(high);
delay (1000);
pin6(low);
while(a==3)
چک کردن a و تغییر مقدار آن درصورن لزوم
با اس ام اس و ریموت
چک کردن سطح باطری