This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Hi , anyone can say on how to configure the digital input and output in nrf52832..??

My objective is , when the button is pressed , the led should glow and when am released the led should turn off. Eventhough i have tried the example code of pin change interrupt , but it won't works Please note that , am externally interfaced the button and led with nrf52DK gpio.

Parents
  • Hello Reeshma

    As you mention the pin change interrupt example does exactly what you want. For it to work you will need to change the PIN_IN and PIN_OUT defines in the example to match the pins you have connected your button and led to. The defines should be changed to the port number of the pins you are using. As an example, if you want the button to be on P0.22, and the led on P0.24 you would change the defines from

    #define PIN_IN BSP_BUTTON_0
    #define PIN_OUT BSP_LED_0
    

    to

    #define PIN_IN 22
    #define PIN_OUT 24
    

    Best regards

    Jørn Frøysa

Reply
  • Hello Reeshma

    As you mention the pin change interrupt example does exactly what you want. For it to work you will need to change the PIN_IN and PIN_OUT defines in the example to match the pins you have connected your button and led to. The defines should be changed to the port number of the pins you are using. As an example, if you want the button to be on P0.22, and the led on P0.24 you would change the defines from

    #define PIN_IN BSP_BUTTON_0
    #define PIN_OUT BSP_LED_0
    

    to

    #define PIN_IN 22
    #define PIN_OUT 24
    

    Best regards

    Jørn Frøysa

Children
Related