Inside the loop, you check to see if the button is pressed, and if so, turn on the LED.
Otherwise the LED is off.
That's all there is to controlling an LED with a button switch!
Analog In
Your microcontroller board has both digital and analog signal capabilities. Some pins
are analog, some are digital, and some are capable of both. Check the Pinouts page
in this guide for details about your board.
Analog signals are different from digital signals in that they can be any voltage and
can vary continuously and smoothly between voltages. An analog signal is like a
dimmer switch on a light, whereas a digital signal is like a simple on/off switch.
Digital signals only can ever have two states, they are either are on (high logic level
voltage like 3.3V) or off (low logic level voltage like 0V / ground).
By contrast, analog signals can be any voltage in-between on and off, such as 1.8V or
0.001V or 2.98V and so on.
Analog signals are continuous values which means they can be an infinite number of
different voltages. Think of analog signals like a floating point or fractional number,
they can smoothly transiting to any in-between value like 1.8V, 1.81V, 1.801V, 1.8001V,
1.80001V and so forth to infinity.
Many devices use analog signals, in particular sensors typically output an analog
signal or voltage that varies based on something being sensed like light, heat,
humidity, etc.
©Adafruit Industries
Page 131 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?