Dear friends,
I am trying to send an sms using arduino Uno and the sim 900 interfaced. I have connected Rx of Sim900 to Tx(pin8) of Uno, Tx of sim900 to Rx(pin7) of Uno, and of course ground to ground of each other. Please help me, I am unable to send the sms. Following is my code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7,8); //RX and TX pins to communicate with the GSM module
String mobNumber = "8762451263"; //The number to be texted(some number)
boolean trigger;
void setup(){
Serial.begin(9600);
mySerial.begin(9600);
trigger=false;
mySerial.println("AT");
}
void loop(){
if(trigger==false){
mySerial.println("AT+CMGF=1;"); // Set the Mode as Text Mode
delay(150);
mySerial.println("AT+CMGS=\"+91"+mobNumber+"\";"); // Specify the Destination number in international format
delay(150);
mySerial.print("First Message"); // Enter the message and append the ldr value
delay(150);
mySerial.write((byte)0x1A); // End of message character 0x1A : Equivalent to Ctrl+z
delay(50);
mySerial.println();
delay(50);
trigger=true;
}
}