当前位置:网站首页>Arduino drive lcd1602a
Arduino drive lcd1602a
2022-07-24 09:46:00 【Jiang tengxia】
Demo_01、 Display temperature and humidity data
Be careful : According to my code annotation Make wiring , If you still don't understand, check lcd Of User manual , There is a detailed circuit diagram !
#include <LiquidCrystal.h>//LCD The header file
#include <dht11.h>// Import dht11 The header file
#define DhtPIN 2 //dht11 Controlled port
#define RS 6 //LCD1602 Of RS port
//RW、VSS、K Pick up GND,VDD、A Pick up VCC
#define E 7 //LCD1602 Of E port
#define D_Four 9 //LCD1602 Of D4 port
#define D_Five 10 //LCD1602 Of D5 port
#define D_six 11 //LCD1602 Of D6 port
#define D_Seven 12 //LCD1602 Of D7 port
LiquidCrystal lcd(RS,E,D_Four,D_Five,D_six,D_Seven);
void setup() {
lcd.begin(16,2); // Set up LCD by 2 That's ok 16 Column
Serial.begin(9600);
}
void loop() {
dht11 DHT11;
int chk = DHT11.read(DhtPIN); // Read sensor data
Serial.print("chk = "); // Serial port print results , Easy to observe and debug
Serial.println(chk); // Serial port print results , Easy to observe and debug
lcd.setCursor(0,0); // initialization LCD The pointer of 1 Xing di 1 Column ( Subscript to be 0)
lcd.print("Temp:"); //LCD Show “Temp:” character
lcd.print((float)DHT11.temperature,0); // Display temperature data ,2 Significant digits
lcd.print("℃"); // The back shows “℃” Company character
Serial.print("temp = "); // Serial port print results , Easy to observe and debug
Serial.println((float)DHT11.temperature); // Serial port print results , Easy to observe and debug
lcd.setCursor(0,1); // initialization LCD The pointer of 2 Xing di 1 Column
lcd.print("Hum:"); //LCD Show “Hum:” character
lcd.print((float)DHT11.humidity,0); // Display humidity data ,2 Significant digits
lcd.print("%"); // The back shows “%” Company character
Serial.print("Hum = "); // Serial port print results , Easy to observe and debug
Serial.println((float)DHT11.humidity); // Serial port print results , Easy to observe and debug
delay(2000);
}
边栏推荐
- Hucang integrated e-commerce project (I): introduction to the project background and structure
- Understanding of magnetic parameters in Hall sensors
- Calculate CPU utilization [Prometheus]
- 《动手学深度学习》(七) -- 边界框和锚框
- PHP Basics - session control - Session
- 07 Jason module
- ThreeJs
- 【机器人学习】机构运动学分析与matlab仿真(三维模型+word报告+matlab程序)
- Do you really understand the concept of buffer? Take you to uncover the buffer zone~
- Dorissql syntax Usage Summary
猜你喜欢

Friends come to interview a unicorn company in Beijing at leisure. The interview question is priced at 25K

Leetcode skimming: dynamic planning 03 (climb stairs with minimum cost)

Hands on deep learning (VII) -- bounding box and anchor box

Open source summer interview | learn with problems, Apache dolphin scheduler, Wang Fuzheng

Openstack network neutron knowledge point "openstack"

Embedded development: Tools - optimizing firmware using DRT

Vscode failed to use SSH Remote Connection (and a collection of other problems)

Development history of the first commercial humanoid biped robot in China

Spark Learning: build SQL to meet the specified optimization rules

Linux deployment mysql8.0
随机推荐
It's eleven again. Those jokes about nagging programmers going home for blind dates
Redis configuration serialization
JS string method
Spark Learning: compile spark source code in win10
Hucang integrated e-commerce project (I): introduction to the project background and structure
Build practical product help documents to improve user satisfaction
PHP caching system - PHP uses Memcache
力扣300-最长递增子序列——动态规划
Anti shake and throttling
Spark Learning: Spark implementation of distcp
Getting started with identityserver4
Synchronized scope "concurrent programming"
How to improve office efficiency through online collaborative documents
Firewalld firewall related commands
Aruba学习笔记06-无线控制AC基础配置(CLI)
Development history of the first commercial humanoid biped robot in China
Dorissql syntax Usage Summary
[don't bother to strengthen learning] video notes (II) 1. What is Q-learning?
Es search summary
07 Jason module