I have this project where I have managed to build and flash my code onto the controller. I copied the example code from blinky (that didn't work) to my main.c and then I changed some pins, still didn't work. So what I tried was that I searched up and came across nrf_bpio_cfg_output and nrf_gpio_pin_set/clear in order to set and clear my pins. The problem still persists, I don't know if has something to do with setting the wrong output pin or something, I really don't know. Even tried multiple pins.
I want the output to be on pin 7, or pin name P0.03. On my nRF51802 chip mounted on a custom board.
I'm using "nRF51 SDK v10.0.0" and gcc compiler, therefore without IDE.
main.c:
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
/** @file
*
* @defgroup blinky_example_main main.c
* @{
* @ingroup blinky_example
* @brief Blinky Example Application main file.
*
*/
#define BUZZPIN 25
#define LEDPIN 3
#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
// #include "boards/boards.h"
// const uint8_t leds_list[LEDS_NUMBER] = LEDS_LIST;
/**
* @brief Function for application main entry.
*/
int main(void)
{
/* // Configure LED-pins as outputs.
LEDS_CONFIGURE(LEDS_MASK);
// Toggle LEDs.
while (true)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
LEDS_INVERT(1 << leds_list[i]);
nrf_delay_ms(500);
}
}*/
nrf_gpio_cfg_output(LEDPIN);
while (1)
{
nrf_gpio_pin_set(LEDPIN); // turn it on
nrf_delay_ms(500);
nrf_gpio_pin_clear(LEDPIN); // turn it off
nrf_delay_ms(500);
}
}
/** @} */