Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

ESP32 ADC: LECTURA DE

VALORES ANALÓGICOS CON


ARDUINO IDE
Angolli Natalia Riaño Acuña
1 Universidad Ecci , Ingeniería Biomédica Bogotá, Colombia
angollin.rianoa@ecci.edu.co
Resumen

El ESP32 tiene un controlador LED PWM


con 16 canales independientes que se pueden
configurar para generar señales PWM con
diferentes propiedades.
Estos son los pasos que deberá seguir para
atenuar un LED con PWM usando el IDE de
Arduino:
1. Primero, debes elegir un canal PWM. Hay
resoluciones de 1 a 16 bits. Usaremos una
16 canales del 0 al 15.
resolución de 8 bits, lo que significa que
2. Luego, debe configurar la frecuencia de la puede controlar el brillo del LED usando un
señal PWM. Para un LED, está bien utilizar valor de 0 a 255.
una frecuencia de 5000 Hz.

3. También necesitas configurar la resolución


.
del ciclo de trabajo de la señal: tienes
1. First, you must choose a PWM channel.
There are 16 channels from 0 to 15.
Abstract
2. Next, you need to set the frequency of the
The ESP32 has a PWM LED controller with 16 PWM signal. For an LED, it is okay to use a
independent channels that can be configured to frequency of 5000 Hz.
generate PWM signals with different
properties. 3. You also need to set the signal duty cycle
resolution: you have resolutions from 1 to 16
These are the steps you will need to follow to bits. We will use 8-bit resolution, which means
dim an LED with PWM using the Arduino you can control the brightness of the LED
IDE: using a value from 0 to 255.

INTRODUCCION

Empiece por definir el pin al que está properties, different than these, to generate
conectado el LED. En este caso el LED está different PWM signals.
conectado aGPIO 16.
const int ledPin = 16; // 16 corresponds to const int freq = 5000;
GPIO16 const int ledChannel = 0;
Then, you set the PWM signal properties. const int resolution = 8;
You define a frequency of 5000 Hz, choose In the setup(), you need to configure LED
channel 0 to generate the signal, and set a PWM with the properties you’ve defined
resolution of 8 bits. You can choose other
earlier by using the ledcSetup() function that signal is the ledChannel, that corresponds to
accepts as arguments, the ledChannel, the channel 0.
frequency, and the resolution, as follows: ledcAttachPin(ledPin, ledChannel);
ledcSetup(ledChannel, freq, resolution); In the loop, you’ll vary the duty cycle
Next, you need to choose the GPIO you’ll get between 0 and 255 to increase the LED
the signal from. For that use brightness.
the ledcAttachPin() function that accepts as
arguments the GPIO where you want to get for(int dutyCycle = 0; dutyCycle <= 255;
the signal, and the channel that is generating dutyCycle++){
the signal. In this example, we’ll get the // changing the LED brightness with PWM
signal in the ledPin GPIO, that corresponds ledcWrite(ledChannel, dutyCycle);
to GPIO 16. The channel that generates the delay(15);
}
DIAGRAMA
CONCLUSIONES

 El tutorial proporciona un código de ejemplo para


programar el ESP32 y usar los pines táctiles para
despertar el ESP32 del modo de sueño profundo.
 El proyecto es una muestra de cómo la tecnología
de los pines táctiles del ESP32 puede ser utilizada
para mejorar la funcionalidad y la eficiencia de los
proyectos de IoT.

You might also like