Skip to main content
1 of 4

Interrupt variable not getting called while executing another part

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 its 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().