SunFounder ESP32 Starter Kit
(continued from previous page)
led.value(0) # turn the LED off
Two types of transistors can be controlled using the same code. When we press the button, the ESP32 will send a
high-level signal to the transistor; when we release it, it will send a low-level signal.
• The circuit using the S8050 (NPN transistor) will light up when the button is pressed, indicating that it is in a
high-level conduction state;
• The circuit using the S8550 (PNP transistor) will light up when the button is released, indicating that it is in a
low-level conduction state.
3.25 5.7 Feel the Light
The photoresistor is a commonly used device for analog inputs, similar to a potentiometer. Its resistance value changes
based on the intensity of the light it receives. When exposed to strong light, the resistance of the photoresistor decreases,
and as the light intensity decreases, the resistance increases.
By reading the value of the photoresistor, we can gather information about the ambient light conditions. This infor-
mation can be used for tasks such as controlling the brightness of an LED, adjusting the sensitivity of a sensor, or
implementing light-dependent actions in a project.
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
Photoresistor
Available Pins
• Available Pins
Here is a list of available pins on the ESP32 board for this project.
Available Pins IO14, IO25, I35, I34, I39, I36
3.25. 5.7 Feel the Light 379