I am trying to read network statuses from a modem using an atmel MCU, and then debug/restart based on certain status replies. I do so with the following code (and this works):
scanf("%s", state);
printf_P(PSTR("%s\n%d\n"),state,tempstate);
if (*state=='4'|| *state=='7' || *state == '9' || *state == '11' || *state == '12' || *state == '13' ||*state == '19' || *state == '30' || *state == '31')
{
count++;
if(count == 5)
{
send_string("ATZ\r");
_delay_ms(10000);
count = 0;
}
else{}
}
However, when trying to do something similar in a pin change interrupt (used for a door switch) I can read the modem reply 'OK', but when trying to confirm that reply with an if statement, the reply is not recognized. See below.
send_string("AT\r\n");
scanf("%s", reply);
printf_P(PSTR("\n%s"),reply);
if (*reply == 'OK')
{
printf_P(PSTR("\nWill text contact now."));
send_string("AT*SMSM2M=\"15555555TESTING\"\r");
scanf("%s", reply);
}
I cannot manage to get my code to enter that if statement after the 'OK' is received. Any help is appreciated.