"); //-->
很简单实现 按键和LED 的控制。
#include "nrf_gpio.h"
//定义自己板子上的 按键 和 led灯 的引脚
#define BUTTON_PIN        17
#define LED_PIN            21
int main(void)
{
    nrf_gpio_pin_pull_t config = NRF_GPIO_PIN_PULLUP;
    nrf_gpio_cfg_output(LED_PIN);
    nrf_gpio_cfg_input(BUTTON_PIN, config);    while(1)
    {        if ( nrf_gpio_pin_read(BUTTON_PIN) == 0 ){
            nrf_gpio_pin_clear(LED_PIN);        //按下按键就点灯
        }else{
            nrf_gpio_pin_set(LED_PIN);            //没按键就灭灯
        }
    }    return 0;
}*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。