Cod
Cod
Cod
#include <LiquidCrystal.h>
#include <MD_DS1307.h>
#include <Wire.h>
#include <SharpIR.h>
#include <EEPROM.h>
GSM gsmAccess;
GSM_SMS sms;
#define trigPin 4
#define echoPin 5
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
// connection state
while (notConnected) {
if (gsmAccess.begin("0000") == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
Serial.println("GSM initialized");
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(13, OUTPUT);
pinMode(IRSensor,INPUT);
void loop() {
{
Serial.print("0746806424 ");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
if (inChar != '\r') {
result[i] = inChar;
i++;
else
if(digitalRead(IRSensor)==HIGH)
Serial.print("0746806424 ");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
// send the message
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
if (inChar != '\r') {
result[i] = inChar;
i++;
else
if(digitalRead(IRSensor)==HIGH)
Serial.print("0759625348");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
while (Serial.available() > 0) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
if (inChar != '\r') {
result[i] = inChar;
i++;
else
if(digitalRead(IRSensor)==LOW)
void loop()
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
else {
if(distance>=10)
{Serial.print("0746806424");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
}
}
else
if(distance>=10)
{Serial.print("0746806424");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
else
if(distance>=10)
{Serial.print("0759625348");
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
delay(10000);
/*
*/
int i = 0;
while (1) {
if (inChar == '\n') {
result[i] = '\0';
Serial.flush();
return 0;
delay(500);