I have a series of code chucks like below for setting up and sending emails from a 3G modem module
These work fine for testing but the settings are hard coded and it would be nice to have them changeable
void SetEmailRcpt(){
strcpy_P(ATcomBuf, PSTR("AT+SMTPRCPT=0,0,\"user@email.com\""));
ATResponseOK();
sendATcommand(ATcomBuf, ATcomResp, 500);
I have added an SD card containing a text file with certain parameters which I have successfully read and parsed the strings out of.
I am trying to work out how to alter the above code to allow me to insert the email address from the SD card which is contained in a string "setting.REA" to replace the "user@email.com" shown above so that it still sends the complete string as below:
AT+SMTPRCPT=0,0,"differentuser@email.com"
The code for sendATcommand is below:
//===============================================================
// GSM/3G Module AT Command send routine #1
//===============================================================
int8_t sendATcommand(char* ATcomBuf, char* expected_answer1,
unsigned int timeout)
{
uint8_t x=0, answer=0;
unsigned long previous; //char response[100];
memset(ATcomResp, EOS, 100); // Initialize the string
delay(100);
while( GSMSerial.available() > 0) GSMSerial.read(); // Clean the input buffer
GSMSerial.println(ATcomBuf); // Send the AT command
x = 0;
previous = millis();
do{ // this loop waits for the answer
if(GSMSerial.available() != 0){
ATcomResp[x] = GSMSerial.read();
x++;
if (strstr(ATcomResp, expected_answer1) != NULL){ // check if the desired answer is in the response of the module
answer = 1;
}
}
}
while((answer == 0) && ((millis() - previous) < timeout)); // Waits for the answer with time out
return answer;
}
On another note I'm struggling for RAM & program space but cant easily change to a mega as the sheilds dont fit and I cant use Software Serial on the pins I need...arrgghhh!! I wish someone would make a Duemilanove/Uno compatible board with more RAM/Program space