资源简介
此代码实现了用树莓派控制RGB LED,用的是wiringPi库中的softPwm库

代码片段和文件信息
#include
#include
#include
#define uchar unsigned char
#define LedPinRed 0
#define LedPinGreen 1
#define LedPinBlue 2
void ledInit(void)
{
softPwmCreate(LedPinRed 0 100);
softPwmCreate(LedPinGreen0 100);
softPwmCreate(LedPinBlue 0 100);
}
void ledColorSet(uchar r_val uchar g_val uchar b_val)
{
softPwmWrite(LedPinRed r_val);
softPwmWrite(LedPinGreen g_val);
softPwmWrite(LedPinBlue b_val);
}
int main(void)
{
int i;
if(wiringPiSetup() == -1){ //when initialize wiring failedprint message to screen
printf(“setup wiringPi failed !“);
return 1;
}
ledInit();
while(1){
ledColorSet(0xff0x000x00); //red
delay(500);
ledColorSet(0x000xff0x00); //green
delay(500);
ledColorSet(0x000x000xff); //blue
delay(500);
ledColorSet(0xff0xff0x00); //yellow
delay(500);
ledColorSet(0xff0x000xff); //pick
delay(500);
ledColorSet(0xc00xff0x3e);
delay(500);
ledColorSet(0x940x000xd3);
delay(500);
ledColorSet(0x760xee0x00);
delay(500);
ledColorSet(0x000xc50xcd);
delay(500);
}
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-07-03 14:45 04_RGB\
文件 6392 2014-06-09 11:21 04_RGB\a.out
文件 129 2014-06-09 11:21 04_RGB\README
文件 1127 2014-08-09 15:48 04_RGB\rgb.c
- 上一篇:篮球比赛电子记分牌 8086 proteus仿真 汇编
- 下一篇:哈夫曼译码流程图
相关资源
- 树莓派B+_入门手册().pdf
- x264源码及其配置文件,用于配置树莓
-
Jli
nkV622c_ARM驱动 - 基于树莓派的可视化可远程遥控网络
- 树莓派运用CV摄像头、视觉巡线.zip
- MT7601(小度wifi360wifimiwif) staap linux驱
- 树莓派3b+学习使用教程
- 树莓派3b+装mate启动文件
- 婴幼儿监护系统的设计与实现
- wiringPi用户手册.pdf
- 最新树莓派开源原理图汇总
- 在树莓派上实现神经计算棒中
- 树莓派3B+原理图
- 树莓派底层驱动WiringPi代码 .rar
- opencv-3.4.0编译失败需要的boostdesc_bgm
- 树莓派基础.pdf
- 树莓派麦克风模块—Adafruit I2S MEMS M
- 树莓派开源原理图汇总
- h5py-树莓派4B.zip
- 内存卡修复工具SDFormatter4.0树莓派玩家
- paho.mqtt.c 树莓派交叉编译版本SDK
- 支持科大讯飞语音识别的树莓派版本
- 树莓派3B+使用手册
- BCM2837- 树莓派3B 芯片手册.pdf
- 安卓端遥控树莓派小车APP
- Xware1.0.31_armel_v5te_glibc.zip
- 树莓派3b+Ubuntumate16.04彩虹屏解决办法
- Onboard SDK开发流程202006111606.pdf
- 2711_1p0- 树莓派4B 芯片手册.pdf
- Ubuntu mate 树莓派引导root文件
评论
共有 条评论