How do I capture the output from an AT command on an Arduino?
I’m using the Arduino Uno R3 with a GSM shield. I have all the AT commands (garden.seeedstudio.com/images/a/ … _V1_00.pdf) and I can enter them just fine if I use the terminal and get output. However how can I capture the resulting output via code? The code below shows what I’ve tried but it does not work. In particular where I attempt to get the analog input and then print out the result.
[code]#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8);
void setup()
{
char sensorValue[32] ="";
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("\r");
delay(1000); //Wait for a second while the modem sends an "OK"
Serial.println("AT+CMGF=1\r"); //Because we want to send the SMS in text mode
delay(1000);
Serial.println("AT+CADC?"); //Get analog input
Serial.println(Serial.available());
Serial.println(Serial.read()); //Print analog input
Serial.println("AT+CMGS=\"+MSISDN\"\r"); //Start accepting the text for the message
//to be sent to the number specified.
//Replace this number with the target mobile number.
delay(1000);
Serial.println("!"); //The text for the message
delay(1000);
Serial.write(26); //Equivalent to sending Ctrl+Z
}
void loop()
{
/*
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
*/
}
[/code]
The results I am getting are:
and
regardless of the changes I make in my analog input