Hi
I am using itead 3g module for sending sms.
it shows error after executing the program. I am using the following coding
#include <SoftwareSerial.h>
#define rxPin 6
#define txPin 7
#define baudrate 9600
const int buttonPin = 2;
int buttonState = 0;
SoftwareSerial mySerial(rxPin, txPin); // RX, TX
char AtCommand[] = “ATI\r”;
void setup()
{
pinMode(buttonPin, INPUT_PULLUP);
// Open serial communications and wait for port to open:
Serial.begin(baudrate);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.println(AtCommand);
// set the data rate for the SoftwareSerial port
Serial.println(“wait 5s for modem to wake up”);
delay(5000);
mySerial.begin(115200);
mySerial.println(“AT+IPR=9600\r\n”); // chnage baudrate to 9600 baud
Serial.println(“Changing baudrate”);
mySerial.begin(baudrate);
mySerial.println(AtCommand);
}
void loop() // run over and over
{
if (mySerial.available())
{
Serial.write(mySerial.read());
}
if (Serial.available())
{
mySerial.write(Serial.read());
}
buttonState = !digitalRead(buttonPin);
if (buttonState == HIGH) {SendSMS();}
}
void SendSMS()
{
mySerial.println(‘AT+CMGF=1’); // Sets the GSM Module in Text Mode
delay(1000); // Delay a 1 second to give the module time to execute the above command
mySerial.println(“AT+CMGS=“61**************”\r”); // Replace x with mobile number THIS IS WHERE IT SEEMS TO BREAK
delay(1000);
mySerial.println(“Hello world SMS message”); // The SMS text (you’ve got 140 characters)
delay(100);
mySerial.println((char)26);// This is the ASCII code for CTRL+Z
delay(1000);
Serial.println(“sent”);
}