当前位置: 首页 > news >正文

福田网站建设设计公司哪家好宁德市疫情最新消息

福田网站建设设计公司哪家好,宁德市疫情最新消息,族谱网站建设方案,asp网站建设代码0、结果 说明:先来看看拍摄的显示结果,如果是你想要的,可以接着往下看。 1、外观 说明:本次使用的oled是0.96寸的,别的规格的屏幕不一定适用本教程,一般而言有显示白色、蓝色和蓝黄一起显示的&#xff0…

0、结果

说明:先来看看拍摄的显示结果,如果是你想要的,可以接着往下看。

1、外观

说明:本次使用的oled是0.96寸的,别的规格的屏幕不一定适用本教程,一般而言有显示白色、蓝色和蓝黄一起显示的,虽然dht11温湿度模块形态各异,但是代码都是适用的,因为它们的模块都是一样的。

2、连线

说明:只需要连接三根线。

uno————dht11

    5V--------------VCC
GND--------------GND

    D7--------------DATA

说明:只需要连接四根线。

uno————oled 0.96

    5V--------------VCC
GND--------------GND

 SCL--------------SCL

 SDA--------------SDA

3、源程序

说明:采用非阻塞方式编写,一定时间检测和显示一次温湿度数据,并将对应功能进行函数化,方便移植。

/****************************************dht11 part****************************************/
#include <dht11.h>                                      //include library
#define dht11Pin 7                                      //Define DHT11 sensor connection pins
#define dht11TimeInterval 1000                          //Detect the time interval of a tripdht11 DHT11;                                            //Instantiate an object
unsigned long dht11Times = 0;                           //Record the device running time
int dhtTemp = 0, dht11Humi = 0;                         //Storage temperature  //Storage humidity
/****************************************oled96 part****************************************/
#include <Arduino.h>                                                          //include library
#include <U8g2lib.h>                                                          //include library
#include <Wire.h>                                                             //include libraryU8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);#define oledTimeInterval 1000                                                 //Detect the time interval of a trip
unsigned long oledTimes = 0;                                                  // Record the device running time/****************************************set up and loop part*********************************/
void setup() {u8g2.begin();                                                               //Example Initialize the IIC
}
void loop() {getTempData();                                                              //Obtain the temperature and humidity valuesoledDisplayMath();                                                          //Display math
}
/****************************************oled96 part****************************************/
/*Display math*/
void oledDisplayMath() {if (millis() - oledTimes >= oledTimeInterval) {                              //This command is executed once in a whileoledTimes = millis();u8g2.setFont(u8g2_font_ncenB14_tr);                                         //u8g2_font_6x12_tru8g2.setFontDirection(0);u8g2.firstPage();do {u8g2.setCursor(0, 15);                                                    //0 means start at the first column and 15 means end at row 15u8g2.print("Temp:");u8g2.setCursor(64, 15);                                                    //0 means start at the first column and 15 means end at row 15u8g2.print(dhtTemp);u8g2.setCursor(96, 15);                                                    //0 means start at the first column and 15 means end at row 15u8g2.print(" C");u8g2.setCursor(0, 31);                                                    //0 means start at the first column and 15 means end at row 15u8g2.print("Humi: ");u8g2.setCursor(64, 31);u8g2.print(dht11Humi);u8g2.setCursor(96, 31);                                                    //0 means start at the first column and 15 means end at row 15u8g2.print(" %");} while ( u8g2.nextPage() );}
}
/****************************************dht11 part****************************************/
/*Obtain the temperature and humidity values*/
void getTempData() {if (millis() - dht11Times >= dht11TimeInterval) {dht11Times = millis();DHT11.read(dht11Pin);                               //Update all sensor informationdhtTemp = DHT11.temperature;dht11Humi = DHT11.humidity;Serial.print("Temperature: ");Serial.print(dhtTemp);Serial.print(" (C), ");Serial.print("Humidity: ");Serial.print(dht11Humi);Serial.println(" (%).");}
}

4、注意事项

说明:需要在线下载<u8glib.h>库文件和<dht11.h>库文件。

http://www.wooajung.com/news/33277.html

相关文章:

  • 中英文切换网站怎么做日本搜索引擎
  • 推广手段和渠道有哪些老铁seo外链工具
  • 医院的网络推广方案seo网站关键词优化快速官网
  • 做产地证的网站常用的网络推广的方法有哪些
  • 忍不住在楼道里面做免费网站网络营销推广方案模板
  • 全屋定制加盟哪个品牌好星链seo管理
  • 环保业网站建设的策划app推广注册赚钱
  • 教育培训类网站建设何鹏seo
  • 手机网站 尺寸汕头seo优化项目
  • 老年门户网站建设的意义怎么自己做网站推广
  • 麻花星空影视传媒制作公司网站线上推广
  • 网站服务费算什么费用百度账号怎么改用户名
  • 网站开发教程 模板seo外链工具源码
  • wordpress 在线预览北京推广优化公司
  • wordpress打开3秒seo关键词怎么优化
  • 旅游建设网站网站seo优化方案策划书
  • 凡科网站建站后 怎么编辑自己的代码源排名前十的大学
  • 做帖子网站seo优化一般包括
  • 网站正在建设中 源码四川自助seo建站
  • 濮阳房产网站建设免费信息发布平台网站
  • 工会网站建设可以百度保障中心人工电话
  • 可以做试卷的网站怎么制作网页链接
  • 如何做网站地图txt网店推广有哪些
  • 网站备案 核验单海南乐秀同城群软件下载
  • 销售牛的网站网络运营推广具体做什么工作
  • 百度推广一年收费标准关键词排名优化怎么样
  • 上海网站开发多少钱优化防控举措
  • 企业官方网站建设app推广活动策划方案
  • 许昌网站建设汉狮套餐百度搜索引擎网站
  • 湖南网站搜索排名优化电话网店推广分为哪几种类型