91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

此代碼實(shí)現(xiàn)了用樹(shù)莓派控制RGB LED,用的是wiringPi庫(kù)中的softPwm庫(kù)

資源截圖

代碼片段和文件信息

#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;
}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????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

評(píng)論

共有 條評(píng)論

相關(guān)資源