当前位置:网站首页>nRF52832 GPIO LED
nRF52832 GPIO LED
2022-06-30 07:11:00 【Delta-delta】
Hardware connection
initialization GPIO
nrf_gpio_cfg_output( Pin number );
Buy low
nrf_gpio_pin_clear( Pin number );
Set high
nrf_gpio_pin_set( Pin number );
Flip
nrf_gpio_pin_toggle( Pin number );
Example
#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#define LED_B 24
#define LED_R 23
#define LED_G 22
/** * @brief Function for application main entry. */
int main(void)
{
/* Configure board. initialization GPIO For export */
nrf_gpio_cfg_output(LED_G);
nrf_gpio_cfg_output(LED_R);
nrf_gpio_cfg_output(LED_B);
// Turn on the light when set low
nrf_gpio_pin_clear(LED_B);
nrf_gpio_pin_clear(LED_G);
nrf_gpio_pin_clear(LED_R);
/* Toggle LEDs. */
while (true)
{
nrf_gpio_pin_toggle(LED_R);
nrf_gpio_pin_toggle(LED_G);
nrf_gpio_pin_toggle(LED_B);
nrf_delay_ms(500);
}
}
边栏推荐
- Realization of dissolve effect in unity and its principle analysis
- QT common macro definitions
- [my advanced OpenGL learning journey] about the access methods of vector and matrix classification of OpenGL shaders: xyzw/rgba/stpq and array subscripts
- First line of code (Third Edition) learning notes
- 网络安全-VLAN和Tunk方法详解
- [most complete] install MySQL on a Linux server
- What if I don't know what to do after graduating from university?
- 汇编语言学习一(有栈协程铺垫,32位寄存器和相关指令学习,未完待续06/29)
- [solved] failed! Error: Unknown error 1130
- Finished product upgrade procedure
猜你喜欢
六,购物⻋与订单
[resolved] MySQL exception: error 1045 (28000): unknown error 1045, forgetting the initial password
Daemon and user threads
Linux服務器安裝Redis
Realization of dissolve effect in unity and its principle analysis
[hot100] palindrome substring and longest palindrome substring
MySQL Optimization: from more than ten seconds to 300 milliseconds
B站首个UP主付费观看视频还是来了!价格“劝退”网友
年轻人搞副业有多疯狂:月薪3000,副业收入3W
经纬恒润再次荣获PACCAR集团 10PPM 质量奖
随机推荐
The class imported by idea import clearly exists, but it is red?
Vs2019 and SQL
【已解决】MySQL异常:ERROR 1045 (28000): Unknown error 1045,忘记初始密码
MySQL Optimization: from more than ten seconds to 300 milliseconds
2022年6月29日--使用C#迈出第一步--使用 C# 中的“if”、“else”和“else if”语句向代码添加决策逻辑
Class template case - encapsulation of array classes
[datawhale team learning] task02: mathematical operation, string and text, list
[solved] failed! Error: Unknown error 1130
Traverse map
All errors reported by NPM
MySQL优化:从十几秒优化到三百毫秒
免实名域名是什么意思?
[my advanced OpenGL learning journey] about the access methods of vector and matrix classification of OpenGL shaders: xyzw/rgba/stpq and array subscripts
Connection Flood攻击原理
Double click the idea to solve the problem of downloading again
Golan common shortcut key settings
2、 Layout system
【每日一题】535. TinyURL 的加密与解密
Xshell transfer file
Install go language development tools