SunFounder ESP32 Starter Kit
(continued from previous page)
# Create a pin object named greyscale, set pin number 14 as input
line = machine.Pin(14, machine.Pin.IN)
while True:
# Check if the value is 1 (black)
if line.value() == 1:
# Print "black"
print("black")
time.sleep(0.5)
# If the value is not 1 (it's 0, which means white)
else :
# Print "white"
print("white")
time.sleep(0.5)
When the line tracking module detects there is black line, there appears “black” on the Shell; otherwise, “white” is
displayed.
3.23 5.5 Detect Human Movement
Passive infrared sensor (PIR sensor) is a common sensor that can measure infrared (IR) light emitted by objects in its
field of view. Simply put, it will receive infrared radiation emitted from the body, thereby detecting the movement of
people and other animals. More specifically, it tells the main control board that someone has entered your room.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name ITEMS IN THIS KIT LINK
ESP32 Starter Kit 320+
You can also buy them separately from the links below.
COMPONENT INTRODUCTION PURCHASE LINK
ESP32 WROOM 32E
ESP32 Camera Extension -
Breadboard
Jumper Wires
Resistor
LED
PIR Motion Sensor Module
368 Chapter 3. For MicroPython User