Hi!
I've successfully build a project like this - Old Sony Ericsson phone as GSM shield.
My goal is to send an SMS both ways - from my phone to Sony Ericsson, which is connected to Arduino and the other way around. And this works with no problem but I get stuck, when I have to read and further interprate incoming AT responses, so that I could control some relays or sth based on SMS content.
For example let's say I'm communicating through putty:
I make a call from my phone to SE and get a response "RING".
Now, when doing the same thing through Arduino, I'd have to store this "READ" into some string (?) variable, but can't figure out the way to do it. So further on I could do something like:
if (input == "RING") {
digitalWrite...
}
The code I'm using atm is:
#include <SoftwareSerial.h>
// phone connected to pins 2,3 so it doesn't interfere with arduino
SoftwareSerial phone(2,3);
void setup ()
{
// serial connection
Serial.begin(9600);
Serial.println("Arduino connected.");
delay(500);
// phone serial connection
phone.begin(9600);
Serial.println("Ericsson T610 connected.");
delay(1000);
// za?etna inicializacija mobitela
Serial.println("Initialization...");
delay(100);
phone.println("AT+CPMS=\"ME\",\"ME\""); // internal phone storage use
delay(1000);
phone.println("AT+CMGF=0"); // PDU mode
delay(1000);
phone.println("AT+CNMI=2,3,0,0,0"); // transfering incoming data directly to terminal
delay(1000);
Serial.println("Done.");
phone.flush();
}
void loop ()
{
// read phone response
if (phone.available() > 0)
{
char sms = phone.read();
Serial.print(sms);
}
}
This way I get "RING" response, but it's not stored anywhere since it takes each char seperately.
Could I somehow use serialEvent()? I've tried, but no success.
Thanks.