hi guys i want to asking how arduino to read an sms , and send sms back to cellphone. i use df robot gsm shield V3
when i send L to gsm shield, it will receive the sms and send me back to my cellphone sms DATA1=10
but when i send H, gsm shield send me sms DATA1=10, it should send me DATA2=20.
i want to ask how about the program if i use word like DATA1 and send me back DATA1=10
i want to use this gsm for temperature monnitoring with ds18b20, and i still confused how arduino read and send me SMS back.
this is my sketch
byte gsmDriverPin[3] = {
3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!
char inchar;
int dat1 = 10;
int dat2 = 20;
void setup()
{
//Init the driver pins for GSM function
for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin[i],OUTPUT);
}
Serial.begin(9600); //set the baud rate
digitalWrite(5,HIGH); //Output GSM Timing
delay(1500);
digitalWrite(5,LOW);
digitalWrite(3,LOW); //Enable the GSM mode
digitalWrite(4,HIGH); //Disable the GPS mode
delay(2000);
delay(5000); //call ready
delay(5000);
Serial.println("AT+CMGD=1,4"); //Delete all SMS in box
}
void loop()
{
if(Serial.available())
{
inchar=Serial.read();
if(inchar=='T')
{
delay(10);
inchar=Serial.read();
if (inchar=='I') //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port
{
delay(10);
Serial.println("AT+CMGR=1"); //When Arduino read the sign, send the "read" AT command to the module
delay(10);
}
}
if (inchar=='L')
{
delay(10);
inchar=Serial.read(); //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
Serial.println("AT");
delay(2000);
//Send message
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS=\"+6289682765367\"");//Change the receiver phone number
delay(1000);
Serial.print("DATA1= ");//the message you want to send
delay(1000);
Serial.print(dat1);
delay(1000);
Serial.write(26);
delay(10);
Serial.println("AT+CMGD=1,4");
delay(500);
}}
if (inchar=='H')
{
delay(10);
inchar=Serial.read(); //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
Serial.println("AT");
delay(2000);
//Send message
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS=\"+6289682765367\"");//Change the receiver phone number
delay(1000);
Serial.print("DATA2= ");//the message you want to send
delay(1000);
Serial.print(dat2);
delay(1000);
Serial.write(26);
delay(10);
//Turn on led
Serial.println("AT+CMGD=1,4"); //Delete all message
delay(500);
}}}}