Incrementing value issue

//this ticket is a diversion of this ticket @Increment Counter on Button Clicked   https://devzone.nordicsemi.com/f/nordic-q-a/82239/increment-counter-on-button-clicked

Hello Community,
i'm currently trying to increment a counter every time the button is pressed 
the counter is considered like the number of cycle 
well i added some modification to my code to do this function 

        int on_click = 0;
        while(gpio_pin_get_dt(&button) != true ) {
	    on_click++;
        printk("Number of cycle : %d\n", on_click);
        k_msleep(SLEEP_TIME_MS);
        }

this function is part of my project 
and whole project role is :
0-button pressed
1-display BME280 values
2-display MPU6050 values
and now i'm trying to add the number of cycle which means technically how many times the button was pressed 
when i try to view the result on my debug Terminal
it only displays the number of cycle and it doesn't display the values of the other 2 sensors 
and then 5 sec later it stops and it displays the disassembly window on the right just like below


can anyone help me fix this please 

please if you know what is causing this tell me as soon as you can 
thank you in advance 

Kindly,
Rihab

Related