Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Push button status is not changing

Hi team,

I am using customized nRF52833 DK with PCA10100 on it and s140 soft device version..

While reading the pin status, it is not changing value according to the switch position.

Please

//input pins
#define ble_btn         9  
#define chrg_btn        10 

//output pins
#define BattLed_pin     20     
#define BleLed_Pin      30

void log_init(void)
{
  ret_code_t err_code = NRF_LOG_INIT(NULL);
  APP_ERROR_CHECK(err_code);

  NRF_LOG_DEFAULT_BACKENDS_INIT();

}

int main(void)
{
   int cnt = 0;
   uint32_t sw1,sw2;
 nrf_gpio_cfg_output(BattLed_pin); //config the led pin as output pin
 nrf_gpio_cfg_input(chrg_btn,NRF_GPIO_PIN_PULLUP); //config the button pin as input pin

 nrf_gpio_cfg_output(BleLed_Pin); //config the led pin as output pin
 nrf_gpio_cfg_input(ble_btn,NRF_GPIO_PIN_PULLUP);

 //nrf_gpio_pin_clear(led1); //turns off the led

   log_init();

   while(1)
   {
      sw1= nrf_gpio_pin_read(chrg_btn);
    if(sw1 == 0)
    { 
      cnt = 1;
      nrf_delay_ms(500);
      nrf_gpio_pin_toggle(BattLed_pin); //turn on the led

      NRF_LOG_INFO("BLE STARTED ");
      
      nrf_delay_ms(200);
      //while(nrf_gpio_pin_read(chrg_btn)==0); //stay in the loop until the button is released

     // nrf_gpio_pin_set(BattLed_pin); //turns off the led

      }
        
       sw2 = nrf_gpio_pin_read(ble_btn);
      if( sw2 == 0)
      { 
       cnt = 2;
       nrf_delay_ms(500);
       nrf_gpio_pin_toggle(BleLed_Pin);

        nrf_delay_ms(200);
       //while(nrf_gpio_pin_read(ble_btn)==0); //stay in the loop until the button is released

      // nrf_gpio_pin_set(BleLed_Pin); //turns off the led

      }

   }

}
let me know if anything required to configure in sdk_config.h.

Thanks and Regards,

Hareesh Gorle

Parents Reply
  • Hi,

    You're developing for the wrong board, PCA10100is for the nRF52820 simulated on the nRF52833 DK not the nRF52833. 

    The nRF52820 doesn't have P0.09 and P0.10, which is why it doesn't work on your board.

    For starters, you can try to remove NRF52820_XXAA DEVELOP_IN_NRF52833 and add NRF52833_XXAA. You might need to do some further configurations, but this should a good start.. 

    regards

    Jared 

Children
No Data
Related