SunFounder ESP32 Starter Kit
After the program runs, the Shell prints out the photoresistor values. You can shine a flashlight on it or cover it up with
your hand to see how the value will change.
• atten(photoresistor.ATTN_11DB): Configure the ADC attenuation to 11dB for full range.
To read voltages above the reference voltage, apply input attenuation with the atten keyword argument.
Valid values (and approximate linear measurement ranges) are:
– ADC.ATTN_0DB: No attenuation (100mV - 950mV)
– ADC.ATTN_2_5DB: 2.5dB attenuation (100mV - 1250mV)
– ADC.ATTN_6DB: 6dB attenuation (150mV - 1750mV)
– ADC.ATTN_11DB: 11dB attenuation (150mV - 2450mV)
• machine.ADC - MicroPython Docs
3.26 5.8 Turn the Knob
A potentiometer is a three-terminal device that is commonly used to adjust the resistance in a circuit. It features a knob
or a sliding lever that can be used to vary the resistance value of the potentiometer. In this project, we will utilize it to
control the brightness of an LED, similar to a desk lamp in our daily life. By adjusting the position of the potentiometer,
we can change the resistance in the circuit, thereby regulating the current flowing through the LED and adjusting its
brightness accordingly. This allows us to create a customizable and adjustable lighting experience, similar to that of a
desk lamp.
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
Potentiometer
Available Pins
382 Chapter 3. For MicroPython User