[SOLVED] GPS TRIGGER can use as a pin TRIGGER can use as a pin restriction

Thanks Guys it’s working perfectly now

I am just posting final code as reference for anyone.

int GPSflag;

BLYNK_WRITE(V0)   // GPS Trigger
{
  GPSflag = param.asInt();  // Set the flag to 1 or 0
}


BLYNK_WRITE(V1)   // Button that does something if GPSflag is 1
{
  pinMode(13, OUTPUT);
  if (GPSflag == 1)   // Check flag
  {
    //  Do something if flag is 1
   // pinMode(13, OUTPUT);
    digitalWrite(13, HIGH);
    delay(500); 
    digitalWrite(13, LOW);
  }
  else {
    //  Do something else and/or give feedback that something is not allowed in this location
     digitalWrite(13, LOW);
  }
}

void setup()
{
  // Debug console
  SwSerial.begin(9600);

  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

void loop()
{
  Blynk.run();
}
1 Like