I am trying to find a way where when a phone number texts the arduino, the arduino will text back (one time only)
For example. ______________________________
If i use my personal phone and text the arduino the letter "t"
the arduino will automatically text back "how are you"
***so far in the code below i have been able to set it up where if i type the letter "t" into the serial monitor using baud 19200 the arduino will text back "how are you" ,to a specific phone number i have put in the code( +1954xxxxxxx) i put the x's so people wont see my real number
My question is . how can i implement the code where i dont have to type the letter "t" into the serial monitor. I want to be able to text the arduino the letter "t" and have the arduino automatically reply "how are you". if any know hows how or has suggestions i would really appreciate it. i been stuck on this for a while and hit a road block.
below i put the code i have so far
#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial gprsSerial(7,8);
void setup()
{
gprsSerial.begin(19200); // GPRS shield baud rate
Serial.begin(19200);
delay(500);
}
void loop()
{
if (Serial.available()) // if there is incoming serial data
switch(Serial.read()) // read the character
{
case 't': // if the character is 't'
SendTextMessage(); // send the text message
break;
}
if (gprsSerial.available()){ // if the shield has something to say
Serial.write(gprsSerial.read()); // display the output of the shield
}
}
void SendTextMessage()
{
Serial.println("Sending Text...");
gprsSerial.print("AT+CMGF=1\r"); // Set the shield to SMS mode
delay(100);
gprsSerial.println("AT+CMGS = \"+1954xxxxxxx\"");
delay(100);
gprsSerial.println("how are you"); //the content of the message
delay(100);
gprsSerial.print((char)26);//the ASCII code of the ctrl+z is 26 (required according to the datasheet)
delay(100);
gprsSerial.println();
Serial.println("Text Sent.");
}
I don't think the code got attached to the thread, for some reason.
when posting your code, please make sure to use the code tags icon (first icon on the left) and make sure to do CTRL-T (auto format feature within' the Arduino IDE.
Are you using a telecommunication card/shield?
would it be possible to have the model number and/or url link ?
Is there an associated library ?
i am using an arduino Uno with GPRS Shield V2.0.
there is a link for more info on gprs shield v2.0 which is GPRS Shield V2.0 | Seeed Studio Wiki
like i said so far i have to type the letter "t" to serial monitor and then it will send a text saying "hello" to my mobile.
i would like to modify it where i can send the letter "t" with my mobile from and get an automatic reply from the arduino uno saying "hello". and be able to do it over and over again each and every time i text "t" to the arduino.
#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial gprsSerial(7,8);
void setup()
{
gprsSerial.begin(19200); // GPRS shield baud rate
Serial.begin(19200);
delay(500);
}
void loop()
{
if (Serial.available()) // if there is incoming serial data
switch(Serial.read()) // read the character
{
case 't': // if the character is 't'
SendTextMessage(); // send the text message
break;
}
if (gprsSerial.available()){ // if the shield has something to say
Serial.write(gprsSerial.read()); // display the output of the shield
}
}
void SendTextMessage()
{
Serial.println("Sending Text...");
gprsSerial.print("AT+CMGF=1\r"); // Set the shield to SMS mode
delay(100);
gprsSerial.println("AT+CMGS = \"+1954xxxxxxx\"");
delay(100);
gprsSerial.println("how are you"); //the content of the message
delay(100);
gprsSerial.print((char)26);//the ASCII code of the ctrl+z is 26 (required according to the datasheet)
delay(100);
gprsSerial.println();
Serial.println("Text Sent.");
}
Take a look at this guy's project, it is very well written and does what you are looking for. He is using it to lock or opens his car in response to a SMS and send a confirmation SMS back. I'm using it as the basis of a similar project at the moment.
Dear,
I m using Arduino uno and Telecommunication unit SIM900A..I have seen my send sms on serial port but not on mobile screen .Anyone help me to sort out programming issue..
is this solved? if not, i have some idea for your code sir, you can use AT commands in reading the SMS from your mobile then decode it to your objectives, also instead of using serial, why not use the one you created with the use of your software serial.