- Sun Feb 08, 2009 11:12 pm
#65698
Hello, I've connected GM862 (on the Sparkfun USB evaluation) to the Arduino Decimila USB board. The plan is to control GM862 from Arduino. I can execute AT commands, e.g., send an SMS message, but I'm unable to read the response. For example, here is a simple example where I just send an AT command. I expect to get an OK response (according to the spec. with ATV0, I should expect <text><CR><LF><numeric code><CR>.
#include <SoftwareSerial.h>
int rxPin = 7;
int txPin = 8;
SoftwareSerial modem = SoftwareSerial(rxPin, txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
modem.begin(9600);
Serial.begin(9600);
modem.print("ATV0\r\n");
modem.print("AT\r\n");
delay(1000);
// read the 1st character of the response.
// I expect it a valid ASCII character
// but either the code is stuck on reading or
// immediately returns with 0
int response = modem.read();
Serial.println(response);
}
I can see the AT responses fine when I connect to the GM862 USB board directly via a Terminal program. But programatically, I cant get the responses. Any help would be much appreciated. Thank you.
#include <SoftwareSerial.h>
int rxPin = 7;
int txPin = 8;
SoftwareSerial modem = SoftwareSerial(rxPin, txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
modem.begin(9600);
Serial.begin(9600);
modem.print("ATV0\r\n");
modem.print("AT\r\n");
delay(1000);
// read the 1st character of the response.
// I expect it a valid ASCII character
// but either the code is stuck on reading or
// immediately returns with 0
int response = modem.read();
Serial.println(response);
}
I can see the AT responses fine when I connect to the GM862 USB board directly via a Terminal program. But programatically, I cant get the responses. Any help would be much appreciated. Thank you.