Nextion Display call back

Hey,

seeking some advice as I'm new to this, when I put my code into a function with call back it stops working, But if I put the if statement in the loop the code works.

anyone able to help this rookie?

Kind regards,


NexDSButton bt0 = NexDSButton(0, 1, "bt0");

NexTouch *nex_listen_list[] = { 
    &bt0, 
    NULL 
};

void checkZone1(void *ptr) {
    uint32_t number;
    bt0.getValue(&number);
    
    if (number == 1) {
        Serial.println("Zone 1 Active");
    } else {
        Serial.println("Zone 1 De-Active");
    }
}

void setup() {
    Serial.begin(115200);
    nexSerial.begin(115200);
    nexInit();

    bt0.attachPop(checkZone1, &bt0);

    Serial.println("Setup complete");
}

void loop() {
    nexLoop(nex_listen_list);
}