找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2627|回复: 1
收起左侧

Arduino温湿度蓝牙LCD实时显示源程序资料

[复制链接]
ID:426797 发表于 2020-12-18 08:56 | 显示全部楼层 |阅读模式
/*
*Name:        2020.12.12
*Author:        鱼芯电子
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
* DHT11 VCC--VCC GND--GND AO--D8
*/
#include <LiquidCrystal.h>
#include <dht11.h>
#define DHT11PIN 8
dht11 DHT11;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// the setup function runs once when you press reset or power the board
void setup() {
        pinMode(DHT11PIN, OUTPUT);
        // set up the LCD's number of columns and rows:
        lcd.begin(16, 2);
}


// the loop function runs over and over again until power down or reset
void loop() {
        int chk = DHT11.read(DHT11PIN);
        lcd.setCursor(0, 0);
        lcd.print("Tep: ");
        lcd.print((float)DHT11.temperature, 2);
        lcd.print("C");
        // set the cursor to column 0, line 1
        // (note: line 1 is the second row, since counting begins with 0):
        lcd.setCursor(0, 1);
        // print the number of seconds since reset:
        lcd.print("Hum: ");
        lcd.print((float)DHT11.humidity, 2);
        lcd.print("%");
        delay(200);
        //Send data over Bluetooth
        Serial.print("*T" + String((float)DHT11.temperature) + "*");
        Serial.print("*H" + String((float)DHT11.humidity) + "*");
}

VS开发照片.png
演示照片.jpg

温湿度蓝牙LCD实时显示.7z

11.58 MB, 下载次数: 27, 下载积分: 黑币 -5

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:138707 发表于 2023-7-30 12:27 | 显示全部楼层
很好,看看能否实验通过
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表