I have a panda II board and an Seeed GPRS shield (seeedstudio.com/wiki/index.p … ield_v0.9b) The problem is that I cannot send a SMS, I use the following code and get no errors. Nothing happen. Please help.
On the GPRS shield I use the jumpers in Xduino position so I can use the COM1 port of the PANDA.
[code] static SerialPort GSM = new SerialPort(“COM1”, 19200, Parity.None, 8, StopBits.One);
public static void Main()
{
Debug.Print("wait 30 sec startup gsm");
for (int i = 0; i < 30; i++)
{
Thread.Sleep(1000);
Debug.Print(i.ToString());
}
sendSMS("testSMS");
}
static string sendCommand2GSM(string command, int delay)
{
byte[] bytes = Encoding.UTF8.GetBytes(command);
GSM.Write(bytes, 0, bytes.Length);
Thread.Sleep(delay);
byte[] inData = new byte[GSM.BytesToRead];
GSM.Read(inData, 0, GSM.BytesToRead);
string str1 = new string(Encoding.UTF8.GetChars(inData));
return str1;
}
static void sendSMS(string message2Send)
{
try
{
GSM.Handshake = Handshake.None;
GSM.Open();
Debug.Print("gsm conn open");
string GSMResponse = "";
string GSMCommand = "";
GSMCommand = "AT+CMGF=1";
GSMResponse = sendCommand2GSM(GSMCommand + "\n\r", 1000);
Debug.Print("send start command");
GSMCommand = "AT+CMGS=\"0681480290\"";
GSMResponse = sendCommand2GSM(GSMCommand + "\n\r", 1000);
Debug.Print("send sms");
GSMResponse = sendCommand2GSM(message2Send + (char)26, 15000);
Debug.Print("done");
}
finally
{
GSM.Close();
}
}[/code]