volatile byte _incomingFlag = 0;
void onIncoming () {
_incomingFlag = 1;
Serial.println(F("You got an interrupt"));
mySerial.println("ATH0");
}
void setup () {
/* First Start the module */
Serial.begin(9600);
Serial.println(F("Initializing module..."));
powerOn();
mySerial.begin(9600);
sendcommand(F("AT"), F("OK"), 1000);
sendcommand(F("AT+CLIP=1"), F("OK"), 1000);
sendcommand(F("AT+CMGF=1"), F("OK"), 1000);
/* We need to attach ringing Interrupt */
attachInterrupt(M_RING_INTERRUPT, onIncoming, FALLING);
delay(100);
}
void loop() {
if (_incomingFlag == 1) {
manageIncoming();
Serial.print(F("_incomingFlag: "));
Serial.println(_incomingFlag);
} else {
Serial.println(_incomingFlag);
Serial.println(F("not getting value"));
}
get_currentLocation();
send_Location();
}
I am trying to check the value of incomingFlag
from the loop()
. When I get a call or an SMS the interrupt function is getting executed and incomingFlag
is set to 1 but I am not getting that value from the loop()
. Everytime it's getting 0 if I check the value while the send_Location
function is executing (data uploading part). How can I access the value of incomingFlag
from the main loop()
.
send_Location
function personally, because you did not post it.