hi guys,
i need some help with my project.
i want to create a system with auto reply if wrong format. the proper format is name\r\ndepartment\r\nshift\r\ninformation\r\nreason.
i want to have to auto reply first is system receive and the other one is invalid format.
how can system know if wrong format and it will send wrong format of information?
plss help me thanks in advance
#include "SIM900.h"
#include <GSM.h>
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
#include "inetGSM.h"
//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;
//To change pins for Software Serial, use the two lines in GSM.cpp.
//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.
//Simple sketch to send and receive SMS.
//#ifndef DateTime_h
#define DateTime_h
#include <inttypes.h>
int numdata;
int messageIndex = 0;
boolean started = false;
char smsbuffer[160];
char n[20];
#define PHONE_NUMBER "09176282105"
//#define phone "09178859061"
#define message "SYSTEM RECEIVED YOUR INFORMATION -NO NEED TO REPLY- "
#define message1 "SYSTEM READY"
//define message2 "NO NEED TO REPLY"
#define MESSAGE_LENGTH 160
//char message[MESSAGE_LENGTH]
char sms_position;
char phone_number[20]; // array for the phone number string
char sms_text[160];
char DateTime[24];
int i;
//debug begin
//debug end
void setup()
{
//Serial connection.
Serial.begin(9600);
//Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(4800)) {
Serial.println("\nstatus=READY");
started = true;
}
else
Serial.println("\nstatus=SYSTEM ERROR");
if (started)
{
//Enable this two lines if you want to send an SMS.
if (sms.SendSMS("09176282105", message1))
// if (sms.SendSMS(phone, message1))
// Serial.println("\nSMS sent OK");
//if NO SPACE ,you need delte SMS from position 1 to position 20
//please enable this four lines
for (i = 1; i <= 20; i++)
{
sms.DeleteSMS(i);
}
}
}
char rx_byte = 0;
void loop()
{
if (started)
{
//Read if there are messages on SIM card and print them.
sms_position = sms.IsSMSPresent(SMS_UNREAD);
if (sms_position)
{
// read new SMS
// Serial.print("SMS postion:");
// Serial.println(sms_position,DEC);
gsm.readSMS(sms_position, phone_number, sms_text, 160);
// now we have phone number string in phone_num
String stringOne = sms_text;
Serial.println(stringOne);
String stringTwo = stringOne;
// then perform the replacements:
stringTwo.replace("/", "\r");
// Serial.println(stringTwo);
gsm.SimpleWriteln("stringTwo");
Serial.println(DateTime);
Serial.println(phone_number);
if (sms.SendSMS(PHONE_NUMBER, sms_text))
if (sms.SendSMS(phone_number, message))
if (sms.SendSMS(phone_number, message2))
if (sms.SendSMS(phone, sms_text))
// Serial.println(phone_number, 20, sms_text, 160);
}
// if else
// {
// Serial.println("NO NEW SMS,WAITTING");
// while(1) { }
{
sms.DeleteSMS(i);
}
}
}
}
as of now im stock on this
im a rookies on programing plsss can any ony help me i want to know how can i do this project. thanks thanks thanks