I am working about Keypad example. I have 3 Row and 5 colomb. Whatever when i debug it advertising stop. Interrupt working greak without advertising.
I am working about Keypad example. I have 3 Row and 5 colomb. Whatever when i debug it advertising stop. Interrupt working greak without advertising.
Hi,
Could you share a bit more information on where the issue occurs? Preferably with code?
Best regards,
Håkon
When i Keypad_Scan() file add for(;;) loop problem is solved. But i have a new problem now!
I want to change when pressed button led blink 200ms than led blink off. But this code when i pressed button led blink and i release button led blink off!. how can i choose it. I shared code below my comment.
#include <stdbool.h> #include <stdint.h> #include "boards.h" #include "nrf_delay.h" #include "nrf_gpio.h" #include "nrf.h" #include "nrf_drv_gpiote.h" #include "app_error.h" #include "nrf_drv_timer.h" #include "app_timer.h" #include "app_button.h" #include "nrf_drv_ppi.h" #include "nrf_drv_timer.h" #include "nrf_fstorage.h" #include "nordic_common.h" #include "ble.h" #include "ble_err.h" #include "ble_hci.h" #include "ble_srv_common.h" #include "ble_advdata.h" #include "ble_conn_params.h" #include "nrf_sdh.h" #include "nrf_sdh_ble.h" #include "ble_lbs.h" #include "nrf_ble_gatt.h" #include "nrf_log.h" #include "nrf_log_ctrl.h" #include "nrf_log_default_backends.h" #include "Tus_Tarama_Deneme.h" void Sutun_Cikislari(void) { nrf_gpio_cfg_output(LED_DENEME); nrf_gpio_cfg_output(SUTUN_1); nrf_gpio_cfg_output(SUTUN_2); nrf_gpio_cfg_output(SUTUN_3); nrf_gpio_pin_set(SUTUN_1); nrf_gpio_pin_set(SUTUN_2); nrf_gpio_pin_set(SUTUN_3); nrf_gpio_cfg_input(SATIR_1, NRF_GPIOTE_POLARITY_LOTOHI); nrf_gpio_pin_read(SATIR_1); while(1) { if(nrf_gpio_pin_read(SATIR_1) == true) { nrf_gpio_pin_set(LED_DENEME); } else { nrf_gpio_pin_clear(LED_DENEME); } } }
main.c
int main(void) { // Initialize. leds_init(); timers_init(); log_init(); // Tarama_Basla_Deneme(); buttons_init(); ble_stack_init(); gap_params_init(); gatt_init(); services_init(); advertising_init(); conn_params_init(); // sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); // sd_ble_gap_tx_power_set(0); // Start execution. NRF_LOG_INFO("Blinky example started."); advertising_start(); // Enter main loop. while(1) { Sutun_Cikislari(); if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
When i Keypad_Scan() file add for(;;) loop problem is solved. But i have a new problem now!
I want to change when pressed button led blink 200ms than led blink off. But this code when i pressed button led blink and i release button led blink off!. how can i choose it. I shared code below my comment.
#include <stdbool.h> #include <stdint.h> #include "boards.h" #include "nrf_delay.h" #include "nrf_gpio.h" #include "nrf.h" #include "nrf_drv_gpiote.h" #include "app_error.h" #include "nrf_drv_timer.h" #include "app_timer.h" #include "app_button.h" #include "nrf_drv_ppi.h" #include "nrf_drv_timer.h" #include "nrf_fstorage.h" #include "nordic_common.h" #include "ble.h" #include "ble_err.h" #include "ble_hci.h" #include "ble_srv_common.h" #include "ble_advdata.h" #include "ble_conn_params.h" #include "nrf_sdh.h" #include "nrf_sdh_ble.h" #include "ble_lbs.h" #include "nrf_ble_gatt.h" #include "nrf_log.h" #include "nrf_log_ctrl.h" #include "nrf_log_default_backends.h" #include "Tus_Tarama_Deneme.h" void Sutun_Cikislari(void) { nrf_gpio_cfg_output(LED_DENEME); nrf_gpio_cfg_output(SUTUN_1); nrf_gpio_cfg_output(SUTUN_2); nrf_gpio_cfg_output(SUTUN_3); nrf_gpio_pin_set(SUTUN_1); nrf_gpio_pin_set(SUTUN_2); nrf_gpio_pin_set(SUTUN_3); nrf_gpio_cfg_input(SATIR_1, NRF_GPIOTE_POLARITY_LOTOHI); nrf_gpio_pin_read(SATIR_1); while(1) { if(nrf_gpio_pin_read(SATIR_1) == true) { nrf_gpio_pin_set(LED_DENEME); } else { nrf_gpio_pin_clear(LED_DENEME); } } }
main.c
int main(void) { // Initialize. leds_init(); timers_init(); log_init(); // Tarama_Basla_Deneme(); buttons_init(); ble_stack_init(); gap_params_init(); gatt_init(); services_init(); advertising_init(); conn_params_init(); // sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); // sd_ble_gap_tx_power_set(0); // Start execution. NRF_LOG_INFO("Blinky example started."); advertising_start(); // Enter main loop. while(1) { Sutun_Cikislari(); if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
Hi,
I recommend that you use app_timer for delayed operations. Here's a tutorial on how to use this:
https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/application-timer-tutorial
Best regards,
Håkon