Lea el mando de un potenciómetro
Conecte un potenciómetro y observe cómo cambia su valor al girarlo
Lea el mando de un potenciómetro es una lección gratuita de Arduino & IoT Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Arduino & IoT Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Arduino & IoT Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
Meet the Potentiometer
A potentiometer, or pot, is a knob you turn to change resistance. It is the easiest analog input to start experimenting with.
It Has Three Pins
A pot has three legs: two outer pins for power and ground, and a middle wiper pin that gives the changing voltage.
Wire the Outer Pins
Connect one outer pin to 5V and the other to GND. This sets up the full voltage range across the pot.
Wire the Wiper to A0
Run the middle wiper pin to an analog input like A0. As you turn the knob, the voltage on that pin moves.
It Is a Voltage Divider
Inside, the pot acts as a voltage divider. Turning the shaft moves a contact that splits 5V into the reading you sense.
Read the Knob in Code
Reading it is one line. Call analogRead(A0) and you get a value from 0 to 1023 that tracks the knob position.
int pot = analogRead(A0);Fully Left Reads 0
Turn the knob all the way toward the GND side and the reading drops to about 0. The wiper now sees zero volts.
Fully Right Reads 1023
Turn it fully toward the 5V side and the value climbs to about 1023. The wiper now sees the full supply voltage.
Print It to Watch
Send the value to the Serial Monitor so you can watch it change live. Use Serial.println inside your loop.
Serial.println(analogRead(A0));Add a Small Delay
A brief delay keeps the Serial Monitor readable instead of a blur. Ten milliseconds is plenty between samples.
delay(10);A Hands-On Analog Lab
The pot is your personal analog lab. Twisting it is the quickest way to feel how voltage becomes a number.
Quick Check
Which pot pin feeds the Arduino its reading?
Recap: Reading a Knob
You wired a potentiometer with outer pins on 5V and GND and the wiper on A0. Now analogRead tracks the knob from 0 to 1023.
Preguntas frecuentes
¿La lección «Lea el mando de un potenciómetro» es gratis?
Sí — el texto completo de «Lea el mando de un potenciómetro» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Arduino & IoT Academy, actualiza a CoddyKit PRO. El curso de Arduino & IoT Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Lea el mando de un potenciómetro»?
Conecte un potenciómetro y observe cómo cambia su valor al girarlo Practicas Arduino & IoT Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Arduino & IoT Academy?
No se requiere experiencia previa. Arduino & IoT Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.
¿Cuánto tiempo toma la lección «Lea el mando de un potenciómetro»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Arduino & IoT Academy?
Sí. Cada lección de Arduino & IoT Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Señales digitales frente a analógicas
- analogRead devuelve 0–1023
- Lea el mando de un potenciómetro
- Asigne valores a un rango nuevo con map()