- 1、本文档共11页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
温度湿度热释传感器代码(Temperature, humidity, pyroelectric sensor code)
温度湿度热释传感器代码(Temperature, humidity, pyroelectric sensor code)
#包括 stm32f10x_lib。”
#包括“系统。”
#包括USART。”
#包括“延迟。”
#包括“LED。”
#包括“的关键。”
#包括“DHT11。”
短的温、湿度;
int主(空){
stm32_clock_init(9);//系统时钟设置
delay_init(72);//延时初始化
uart_init(729600);//串口1初始化
led_init();/ / LED初始化
key_init();
当(1){
温度= dht11_readtempandhumi(2);
如果(温度 250){ led0 = 0;}
别的{ led0 = 1;}
(180)delay_ms;
该= dht11_readtempandhumi(0);
如果(湿度 550){ LED1 = 0;}
别的{ LED1 = 1;}
(180)delay_ms;
如果(keyrs = = 1){ LED1 = 0;}
别的{ LED1 = 1;}
}
}
#包括 stm32f10x_lib。”
#包括“系统。”
#包括USART。”
#包括“延迟。”
#包括“LED。”
#包括“的关键。”
#包括DS18B20。”
#包括“DHT11。”
#包括“RTC的。”
#包括定时器。”
#包括“remort。”
U16的关键;
U8 Len,T0;
U8 flag_t = 1;
U8 flag_h = 1;
U8 flag_rs = 1;
主(空)
{
stm32_clock_init(9);//系统时钟设置
delay_init(72);//延时初始化
uart_init(729600);//串口1初始化
led_init();
key_init();
dht11_int();
rtc_init();/ / LED初始化
rtc_alr_set(2013,8,13,21,06,00);/ /闹钟
LED1 = 0;
jtag_set(swd_enable);
ds18b20_init();
pwm_init(900,0);/ /不分频。PWM频率= 72000 / 9000 = 8khz
remote_init();/ /初始化红外接收
而(!remote_rdy){ led0 = 0;LED1 = 0;}
led0 = 1;LED1 = 1;
remote_process()关键=;
开关(键){
案例104:
当(1){
键= 1000;
温度= ds18b20_get_temp();
printf(“%高清\n”,温度);
如果(温度>300和flag_t = = 1)
{
/温度=温度/ 10;
temp_mintor();
flag_t = 0;
}
别的{ led0 = 1;} //温度
printf(“%高清\n”,温度);
该= dht11_readtempandhumi(0);
printf(“%高清”,该);
如果(湿度 500和flag_h = = 1)
{
humi_mintor();
flag_h = 0;
}
别的{ LED1 = 1;} //湿度
如果((keyrs1 = = 1 | | keyrs2 = = 1)和flag_rs = = 1)
{
rs_mintor();
flag _ rs = 0;
}
else {led1 = 1;} / / 热释
while (key! = 0) {
delay _ ms (1);
if (usart _ rx _ sta 0x80) {
if (usart _ rx _ buf [0] = = a) {
zhuanxi (1,0,1,0);
yundong (400400); delay _ s (2); zhuanxi (0,0,0,0); printf (temp: \ n); usart _ rx _ sta = 0;
}
if (usart _ rx _ buf [0] = = b) {
zhuanxi (0,1,0,1);
yundong (400400); delay _ s (2); zhuanxi (0,0,0,0); printf (humi: \ n); usart _ rx _ sta = 0;
}
if (usart _ rx _ buf [0] = = c) {
zhuanxi (1,0,1,0); yundong (000500); delay _ s (2); zhuanxi (0,0,0,0);
}
if (usart _ rx _ buf [0] = = d) {
zhuanxi (1,0,1,0); yundon
您可能关注的文档
- 春夜夜从弟桃花园序,赏析(A night from the little garden of order.).doc
- 星空极速可以干什么(What can the sky speed do).doc
- 春熙路和建设路停车(Parking in Chunxi Road and Jianshe Road).doc
- 春夜宴从弟桃花园序(A feast from the little garden order).doc
- 春节祝酒辞(Spring Festival toast).doc
- 春秋和战国时期(The spring and Autumn period and the Warring States Period).doc
- 春节期间隼鹳提高排cburstoutlughingontrrytoonese盼望着做某事xpecttion名的妙招(During the Spring Festival, the Falcon stork raised the platoon cburstoutlughingontrrytoonese looking forward to doing something xpecttion's coup).doc
- 春节祝福语(Spring Festival greetings).doc
- 显卡小知识(Graphics knowledge).doc
- 显卡必读(Graphics must read).doc
文档评论(0)