Hi so I was trying to make an Arduino project using Arduino Uno and a Sim800 GSM module. Basically, when the user would send "Hello" to the GSM, the arduino would reply with "Hello to you too". But I get no response.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9,10); //RX, TX (respectively) pins of programmed Serial Port
char inchar;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);// Set Baud Rate of PUSB Serial Port to 9600 (standard)
mySerial.begin(9600); // Set Baud Rate of Programmed Serial Port to 9600 (standard)
sms(); // Triggers the SMS function
// Can be triggered in the loop by using this same command
}
void loop() {
if(mySerial.available() >0)
{
inchar=mySerial.read();
if(inchar=='H')
{
if(mySerial.find("ello"))
{
reply();
Serial.print(inchar);
delay(100);
}
}
}
}
void sms()
{
mySerial.println("AT+CMGF=1");
delay(1000);
mySerial.println("AT+CMGS=\"+63XXXXXXX\"\r"); // Insert number with country code here
delay(1000);
mySerial.println("Hello World\x1A"); // Message that will send
delay(100);
mySerial.println((char)26);
delay(1000);
}
void reply()
{
mySerial.println("AT+CMGF=1");
delay(1000);
mySerial.println("AT+CMGS=\"+63XXXXX\"\r"); // Insert number with country code here
delay(1000);
mySerial.println("Hello to you too."); // Message that will send
delay(100);
mySerial.println((char)26);
delay(1000);
}
In addition, I tried printing the message into the Serial Monitor and all I get is "H".