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

How do I control an external LED using nRf52832 ble board?

Hey,

I am trying to control an external LED using two nRF52832 boards. I am using "nRF5_SDK_13.0.0_04a0bfd\examples\ble_peripheral\experimental_ble_app_blinky" code for enabling & disabling LED 3 on the peripheral board. I have connected an external LED to board one which is acting as a peripheral device. I am trying to read the status of LED-3 (P0.02) and write that status on to pin P0.11. I used the pullup configuration for input from LED-3(P0.02).

#include "nrf_drv_gpiote.h"

void gpio_init(void) {

nrf_gpio_cfg_output(11);
nrf_gpio_cfg_input(2, NRF_GPIO_PIN_PULLUP);
	

}

int main(void) { gpio_init();

if(nrf_gpio_pin_read(2) == 0)
    {
        nrf_gpio_pin_write(11,1);
    }

}

These are the code lines I have added to the "experimental_ble_app_blinky".

The problem is the "nrf_gpio_pin_read" command reads only once.

I am able to enable & disable the external LED when I use the arduino Uno board (controlled through arduino).

void setup() { pinMode(0, INPUT); pinMode(8, OUTPUT); }

void loop() { if(digitalRead(0) == HIGH){ digitalWrite(8, LOW); } }

This is the code I used for the arduino. And I have shorted the pins P0.02 & P0.19 on the nordic board.

How do I enable the pins on the nRf52832 board wirelessly using bluetooth from another bluetooth connected device?

Thank you in advance.