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

code to blink a led if i pressed a button

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "boards.h"
const uint32_t led1=14;
const uint32_t led2=13;
const uint32_t button=11;
uint32_t P0_10;
uint32_t value;
/**
* @brief Function for application main entry.
*/
int main(void)
{
/* Configure board. */
nrf_gpio_pin_dir_set(led1,'output');
nrf_gpio_pin_dir_set(but,'input');

/* Toggle LEDs. */
P0_10=nrf_gpio_pin_read(button);
if(P0_10!=0)
{
nrf_gpio_pin_write(led1,value=5);

if (value == 0)
{
nrf_gpio_pin_clear(led1);
}
else
{
nrf_gpio_pin_set(led1);
}
}
}

Can anyone tell whats the error in the code , like there is no error but i m not getting output

Related