5、继电器+LED(简单的io口)
2015-08-18 09:26
330 查看
继电器用法比较简单,和LED类似
链接:http://pan.baidu.com/s/1i3rQrjR
#include <stdbool.h> #include <stdint.h> #include "nrf_delay.h" #include "nrf_gpio.h" #include "boards.h" /** * main() function * @return 0. int return type required by ANSI/ISO standard. */ int main(void) { uint8_t output_state = 0; uint8_t i; // Configure LED-pins as outputs nrf_gpio_range_cfg_output(LED_START, LED_STOP); nrf_gpio_cfg_output(LED_GREEN); nrf_gpio_cfg_output(LED_BLUE); nrf_gpio_cfg_output(LED_RED); nrf_gpio_cfg_output(RELAY); nrf_gpio_pin_set(LED_GREEN); nrf_gpio_pin_set(LED_BLUE); nrf_gpio_pin_set(RELAY); while(true) { for(i = 0; i < 7; i++) { nrf_gpio_pin_set(LED_RED); nrf_gpio_pin_set(LED_BLUE); nrf_gpio_pin_toggle(LED_GREEN); nrf_gpio_pin_toggle(RELAY); nrf_delay_ms(100); nrf_delay_ms(100); nrf_delay_ms(100); } for(i = 0; i < 7; i++) { nrf_gpio_pin_set(LED_RED); nrf_gpio_pin_set(LED_GREEN); nrf_gpio_pin_toggle(LED_BLUE); nrf_gpio_pin_toggle(RELAY); nrf_delay_ms(100); nrf_delay_ms(100); nrf_delay_ms(100); } for(i = 0; i < 7; i++) { nrf_gpio_pin_set(LED_GREEN); nrf_gpio_pin_set(LED_BLUE); nrf_gpio_pin_toggle(LED_RED); nrf_gpio_pin_toggle(RELAY); nrf_delay_ms(100); nrf_delay_ms(100); nrf_delay_ms(100); } } }
链接:http://pan.baidu.com/s/1i3rQrjR
相关文章推荐
- iOS中纯手工图片浏览器
- python换行
- MVC下获得服务器的IP地址
- win2012部署asp网站相关
- 算法竞赛入门经典:第七章 暴力求解法 7.13困难的串
- arm底板中linux程序的运行
- 自学MVC看这里——全网最全ASP.NET MVC 教程汇总
- android下使用aapt命令测试启动时间
- Hibernate基础
- 鼠标控制旋转
- AlertDialog对话框按钮位置问题
- C# delegate
- 算法竞赛入门经典:第七章 暴力求解法 7.11回溯法
- 20150817
- POJ 1195 Mobile phones
- 十进制转二进制
- HTML网页设计——01
- 串口之GetCommState、SetCommState函数详解
- 知识空间诊断系统--ALEKS
- 两种方法实现托盘功能