EasyManuals Logo

SunFounder ESP32 User Manual

Default Icon
771 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #408 background imageLoading...
Page #408 background image
SunFounder ESP32 Starter Kit
Here you need to use the library called lcd1602.py, please check if it has been uploaded to ESP32, for a detailed
tutorial refer to 1.4 Upload the Libraries (Important).
import dht
import machine
import time
from lcd1602 import LCD
# Initialize the DHT11 sensor and connect it to pin 14
sensor = dht.DHT11(machine.Pin(14))
# Initialize the LCD1602 display
lcd = LCD()
# Loop to measure temperature and humidity
while True:
try:
# Measure temperature and humidity
sensor.measure()
# Get temperature and humidity values
temp = sensor.temperature()
humi = sensor.humidity()
# Print temperature and humidity
print("Temperature: {}, Humidity: {}".format(temp, humi))
# Clear the LCD display
lcd.clear()
# Display temperature and humidity on the LCD1602 screen
lcd.write(0, 0, "Temp: {}\xDFC".format(temp))
lcd.write(0, 1, "Humi: {}%".format(humi))
# Wait for 2 seconds before measuring again
time.sleep(2)
except Exception as e:
print("Error: ", e)
time.sleep(2)
3.32 5.14 IR Remote Control
An infrared receiver is a component that receives infrared signals and can independently detect and output signals
compatible with TTL level. It is similar in size to a regular plastic-packaged transistor and is commonly used in
various applications such as infrared remote control and infrared transmission.
In this project, we will use an infrared receiver to detect signals from a remote control. When a button on the remote
control is pressed and the infrared receiver receives the corresponding signal, it can decode the signal to determine
which button was pressed. By decoding the received signal, we can identify the specific key or command associated
with it.
402 Chapter 3. For MicroPython User

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the SunFounder ESP32 and is the answer not in the manual?

SunFounder ESP32 Specifications

General IconGeneral
BrandSunFounder
ModelESP32
CategoryController
LanguageEnglish