ESP32 Starter Kit
3. Wiring Diagram
4. Test Code
With the IR remote control, this smart home reveals various sensor values on LCD, including a temperature and hu-
midity sensor, a sound sensor, a photoresistor, a potentiometer and an ultrasonic sensor.
/*
keyestudio ESP32 Inventor Learning Kit
Project 30 Smart Home
http://www.keyestudio.com
*/
#include <LiquidCrystal_I2C.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <xht11.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2␣
˓→line display
const uint16_t recvPin = 19; // Infrared receiving pin
IRrecv irrecv(recvPin); // Create a class object used to receive class
decode_results results; // Create a decoding results class object
long ir_rec;
xht11 xht(26); //The DHT11 connects to IO26
unsigned char dat[] = { 0, 0, 0, 0 }; //Define an array to store temperature and␣
˓→humidity data
(continues on next page)
8.5. Arduino Project 159