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

