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

Unable to control GPIO pins in nRF51422

Hello, i am a beginner, i want to configure an LED to be connected on one of the GPIO pins, please help me with the code.

Parents
  • Hi Verma.

    I don't know excactly what you want to do with the LED. But i assume you want it to light up. The easiest way to control the LED is to use the nrf_gpio interface directly.

    1. Configure the pin as an output: nrf_gpio_cfg_output(pin_number)
    2. Turn on/off the LED:
    • nrf_gpio_pin_set(pin_number)
    • nrf_gpio_pin_clear(pin_number)

    If you want it to blink, I suggest you take a look at this tutorial, which sets up a timer that toggles an LED.

    Best regards

    Joakim

Reply
  • Hi Verma.

    I don't know excactly what you want to do with the LED. But i assume you want it to light up. The easiest way to control the LED is to use the nrf_gpio interface directly.

    1. Configure the pin as an output: nrf_gpio_cfg_output(pin_number)
    2. Turn on/off the LED:
    • nrf_gpio_pin_set(pin_number)
    • nrf_gpio_pin_clear(pin_number)

    If you want it to blink, I suggest you take a look at this tutorial, which sets up a timer that toggles an LED.

    Best regards

    Joakim

Children
Related