资源简介
支持1206,红外模块,超声波模块,LED点阵,舵机模块,温度模块

代码片段和文件信息
//
// FILE: dht.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.22
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: http://arduino.cc/playground/Main/DHTLib
//
// HISTORY:
// 0.1.22 undo delayMicroseconds() for wakeups larger than 8
// 0.1.21 replace delay with delayMicroseconds() + small fix
// 0.1.20 Reduce footprint by using uint8_t as error codes. (thanks to chaveiro)
// 0.1.19 masking error for DHT11 - FIXED (thanks Richard for noticing)
// 0.1.18 version 1.16/17 broke the DHT11 - FIXED
// 0.1.17 replaced micros() with adaptive loopcount
// removed DHTLIB_INVALID_VALUE
// added DHTLIB_ERROR_CONNECT
// added DHTLIB_ERROR_ACK_L DHTLIB_ERROR_ACK_H
// 0.1.16 masking unused bits (less errors); refactored bits[]
// 0.1.15 reduced # micros calls 2->1 in inner loop.
// 0.1.14 replace digital read with faster (~3x) code => more robust low MHz machines.
//
// 0.1.13 fix negative temperature
// 0.1.12 support DHT33 and DHT44 initial version
// 0.1.11 renamed DHTLIB_TIMEOUT
// 0.1.10 optimized faster WAKEUP + TIMEOUT
// 0.1.09 optimize size: timeout check + use of mask
// 0.1.08 added formula for timeout based upon clockspeed
// 0.1.07 added support for DHT21
// 0.1.06 minimize footprint (2012-12-27)
// 0.1.05 fixed negative temperature bug (thanks to Roseman)
// 0.1.04 improved readability of code using DHTLIB_OK in code
// 0.1.03 added error values for temp and humidity when read failed
// 0.1.02 added error codes
// 0.1.01 added support for Arduino 1.0 fixed typos (31/12/2011)
// 0.1.00 by Rob Tillaart (01/04/2011)
//
// inspired by DHT11 library
//
// Released to the public domain
//
#include “dht.h“
/////////////////////////////////////////////////////
//
// PUBLIC
//
int8_t dht::read11(uint8_t pin)
{
// READ VALUES
int8_t result = _readSensor(pin DHTLIB_DHT11_WAKEUP DHTLIB_DHT11_LEADING_ZEROS);
// these bits are always zero masking them reduces errors.
bits[0] &= 0x7F;
bits[2] &= 0x7F;
// CONVERT AND STORE
humidity = bits[0]; // bits[1] == 0;
temperature = bits[2]; // bits[3] == 0;
// TEST CHECKSUM
// bits[1] && bits[3] both 0
uint8_t sum = bits[0] + bits[2];
if (bits[4] != sum)
{
return DHTLIB_ERROR_CHECKSUM;
}
return result;
}
int8_t dht::read(uint8_t pin)
{
// READ VALUES
int8_t result = _readSensor(pin DHTLIB_DHT_WAKEUP DHTLIB_DHT_LEADING_ZEROS);
// these bits are always zero masking them reduces errors.
bits[0] &= 0x03;
bits[2] &= 0x83;
// CONVERT AND STORE
humidity = (bits[0]*256 + bits[1]) * 0.1;
temperature = ((bits[2] & 0x7F)*256 + bits[3]) * 0.1;
if (bits[2] & 0x80) // negative temperature
{
temperature = -temperature;
}
// TEST CHECKSUM
uint8_t sum = bits[0] + bits[1] + bits[2] + bits[3];
if (bits[4] != sum)
{
return DHTLIB_ERROR_CHECKSUM;
}
return result;
}
/////////////////////////////////////////////////////
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-15 17:20 block\
文件 111736 2018-11-19 14:53 block\yfrobot.js
目录 0 2017-12-15 17:20 generator\
文件 51933 2018-11-19 15:46 generator\yfrobot.js
目录 0 2017-12-15 17:20 language\
目录 0 2017-12-15 17:20 language\yfrobot\
文件 4425 2018-11-19 14:52 language\yfrobot\en.js
文件 4564 2018-11-19 14:52 language\yfrobot\spa.js
文件 4423 2018-11-19 14:52 language\yfrobot\zh-hans.js
文件 4424 2018-11-19 14:52 language\yfrobot\zh-hant.js
目录 0 2018-09-18 13:53 media\
目录 0 2018-11-12 16:56 media\yfrobot\
文件 33140 2018-11-07 15:54 media\yfrobot\yf_298P.png
文件 11063 2018-11-03 09:01 media\yfrobot\yf_btn.png
文件 10136 2018-11-03 09:02 media\yfrobot\yf_buzzer.png
文件 10010 2018-11-03 09:03 media\yfrobot\yf_buzzer_p.png
文件 11245 2018-11-03 09:04 media\yfrobot\yf_collision.png
文件 20442 2018-07-10 16:54 media\yfrobot\yf_dht11.png
文件 22848 2018-07-10 16:55 media\yfrobot\yf_dht22.png
文件 31498 2018-05-24 16:08 media\yfrobot\yf_dotMatrix.png
目录 0 2018-10-31 15:38 media\yfrobot\yf_dotMatrix_img\
目录 0 2018-10-31 09:49 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\
文件 35906 2018-10-27 16:57 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_bearPaw.png
文件 33672 2018-10-29 15:07 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_bearPaw2.png
文件 35540 2018-10-29 15:07 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_bearPaw3.png
文件 34256 2018-10-29 15:07 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_bearPaw4.png
文件 36834 2018-10-27 16:56 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_butterfly.png
文件 35704 2018-10-27 16:58 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_camel.png
文件 35093 2018-10-27 16:50 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_cat.png
文件 37439 2018-10-27 16:53 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_cattle.png
文件 37293 2018-10-27 16:50 media\yfrobot\yf_dotMatrix_img\yf_dotMatrix_animal\yf_dotMatrix_chick.png
............此处省略245个文件信息
- 上一篇:新华三模拟测试软件
- 下一篇:IEC61508英文版2010
相关资源
- ADNS-3080光流传感器测试程序Arduino
- EESkill NRF24L01 无线模块用户手册
- Arduino nano 工程文件
- Arduino教程 Lesson 之--自制风扇
- 基于Arduino的智能环境监控系统设计
- 基于Arduino和Machtalk的温棚环境监测系
- arduino pca9685多舵机同时控制案例
- arduino技术内幕
- Arduino电子设计实战指南.零基础篇_超
- 物联网智能家居平台DIY:ARDUINO 物联网
- 实验1.zip arduino跑马灯led灯实验,串口
- opencat所有资料.zip
- arduino主机,stm8从机。I2C测试 。每次
- DS18B20_Serial_println.ino
- ps2手柄arduino库文件
- 基于手机蓝牙的arduino遥控小车
- arduino中的can库函数
- 密码+指纹锁资料包.rar
- 贝壳物联arduino esp8266 demo版本
- HMC5883L罗盘指南针模块库文件及中英文
- arduino 小贱钟源码及教程
- Atom-TMC2208Pilot在Arduino上运行的应用程
- 写字机制作方案
- PID-增量式PID和位置式PID算法实现和
- Building Wireless Sensor Networks Using Arduin
- vc控制Arduino,实现串口通信
- Arduino入门经典
- Arduino所有库.zip
- 基于STM32和arduino的MPU9250九轴传感器代
- GY-9960模块Keil 和Arduino驱动程序
评论
共有 条评论