How to set a GPIO

Hi

I wanna use second pin of nRF52832 as a gpio output pin.

I'm using software as a follows.

・nRF5_SDK_17.1.0_ddde560

I don't know which function programs I must use to solve.

Please tell me how to set. 

  • Hello,

    To see a demonstration on how this could be done I highly recommend that you take a look at the Pin Change Interrupt example from the SDK. This example shows how you could use the input on one pin to set the output of another pin.

    Please do not hesitate to ask if any part of it should be unclear, or if you have any other issues or questions with this!

    Best regards,
    Karl

  • Thank you for your reply.

    I'm trying to use nRF52 pin (P0.11) as a output when recieved data from  smartphone through BLE.

     (I use EVK-NINA-B1 as a evaluation board)

    Please tell me  which number I must configure as a follows.

     #define PIN_IN BSP_BUTTON_0

     #define PIN_OUT BSP_LED_0

    I don't know pin number for BSP_BUTTON_0 and BSP_LED_0 on my case.

     

  • TakaTaka said:
    Thank you for your reply.

    No problem at all, I am happy to help!

    TakaTaka said:

    I'm trying to use nRF52 pin (P0.11) as a output when recieved data from  smartphone through BLE.

     (I use EVK-NINA-B1 as a evaluation board)

    If you are using a different board then you will need to change the board file used in the example.
    You will also need to change the BOARD_PCA100* define in your Project options -> Common configuration -> Preprocessor -> Preprocessor Definitions.
    This define is used by the boards.h file to include the correct board file to the project, which in turns details how many and what pins the different peripherals are located on.

    Alternatively, just to get this pin change example up and running, you could change the defines to instead use P0.11 directly:

    #define PIN_IN NRF_GPIO_MAP(0,11)



    Best regards,
    Karl

Related