Debugging GPS trigger

I have two GPS triggers for entering and exiting an area in my app but both don’t work.

An example of one of them in the code: (the enter area is the same)

BLYNK_WRITE(V8)
{
  Serial.println("exit area");
  int pinValue = param.asInt(); 
  if(pinValue == 1){
     Serial.println("foo");
     ...
  }
}

The pins are correct and other buttons work fine in this project.
I checked other threads but none had a real answer.
Blynk app has GPS permission (I use android 7).

I also tried to mock my location (FakeGPS app) in my phone to simulate entering and exiting the area I defined but it doesn’t do anything and nothing shows up in the serial monitor.

Any ideas on how to debug this?

I am guessing this is not all the code (this would not likely compile)…

Not really. Hard to troubleshoot without all the details :wink:

One thing I see is that you are not using Global variables. Are you trying to do anything with the trigger state outside of this function?

Of course the triple dots represent irrelevant code, you can treat them as empty lines.

Posting the whole project will introduce a lot of noise and that won’t help anyone.

I don’t understand about the global variable, why should this be a global variable? I just need that value for the if you see.

This is loop and setup, the rest is just other irrelevant functions.

void setup()
{
  pinMode(D3, OUTPUT);
  digitalWrite(D3, LOW);  
  pinMode(BUILTIN_LED, OUTPUT);  	// set onboard LED as output
  digitalWrite(BUILTIN_LED, HIGH);	// led logic is inverted 
  // Debug console
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);

  Blynk.begin(auth, ssid, pass);

  irsend.begin();

  //  Force the ESP into client-only mode
  WiFi.mode(WIFI_STA); 

  timeClient.begin(); // to turn on the bias light in the morning automatically

  Blynk.syncAll();
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}

While potentially true… neither will absent details. “My coffee tastes funny, can you tell me why? But without tasting it yourself. And no smelling it either… just look at the cup.”

One common way others help here is by actually trying the OP’s code on their own system.

Often troubleshooting is a matter of trial and error, test and observation… not easily done without actual material to work with.

https://www.arduino.cc/reference/en/language/variables/variable-scope--qualifiers/scope/

As for my solution :wink:

I know what global variables, on the contrary, in this case they should be local since that’s the minimal needed scope for their use.

I’ll just do it with IFTTT, it’s too bad your feature doesn’t work, I would’ve prefered it over an IFTTT hack.

That’s the code btw: https://pastebin.com/SYRcwF41