Hi,
I want to see if a button is pressed. But the function app_button_is_pushed() is not working corectly. I am using the s132 in the ble_app_blinky peripheral example. Except the folowing Code the example is unchanged.
int main(void) { // Initialize. log_init(); leds_init(); timers_init(); buttons_init(); power_management_init(); ble_stack_init(); gap_params_init(); gatt_init(); services_init(); advertising_init(); conn_params_init(); // Start execution. NRF_LOG_INFO("Blinky example started."); //advertising_start(); int a=0; // Enter main loop. for (;;) { NRF_LOG_INFO("This makes it work"); if(app_button_is_pushed(0)&&a==0) { a=1; NRF_LOG_INFO("Advertising Started"); advertising_start(); } idle_state_handle(); } }
When I leave the NRF_LOG_INFO("This makes it work") out the code doesn't work when I push the button. If I have the NRF_LOG_INFO in the code like in the example above it works. Additionaly if I debug the session it is working like it should, with or without the NRF_LOG_INFO.
I am a bit confused. Why does it work with the log printed and not without it and what change does the NRF_LOG_INFO make to the Code to work?