REST api pin state not updating

Hello,

I have a capacitive button project using ESP8266 12F on wifi with local server

When button is touched, all is fine in serial print, so I know the interrupt is working fine and button state change is detected. Button is active high and is bi-stable
When using the API GET call the pin state of D4 is not updated, however when setting it via the “update” command url and then running the GET command from the browser (Chrome ARC) the state is updated.

Not sure if I should add anything in the app or in code below to make that work? Or could it have something to do with using pin 4 with internal pull up?

BLYNK_CONNECTED() {
  // Request Blynk server to re-send latest values for all pins
  Blynk.syncAll();

  
}

ICACHE_RAM_ATTR void notifyOnButtonPress()
{
  
  int isButtonPressed = digitalRead(4);
  if (isButtonPressed) {
    Serial.println("Button is ON ");
    Serial.println(isButtonPressed);
    
    // Note:
    //   We allow 1 notification per 5 seconds for now.
    Blynk.notify("Yaaay... button is pressed!");

    // You can also use {DEVICE_NAME} placeholder for device name,
    // that will be replaced by your device name on the server side.
    //Blynk.notify("Yaaay... {DEVICE_NAME}  button is pressed!");
  } else {
   Serial.println("Button is OFF ");
 }
}


void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass, IPadd, 8080);

  // Setup notification button on GPIO4
  pinMode(4, INPUT_PULLUP);
  // Attach GPIO 4 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(4), notifyOnButtonPress, CHANGE);
  
  
}

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



I’d say that you’d be better to update a virtual pin to reflect the state of your digital pin.

Pete.

Will try that Thank you