Conectarse a WiFi en modo estación
Conéctese a su red e imprima la dirección IP.
Conectarse a WiFi en modo estación 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.
What Station Mode Is
When your board joins an existing network like a phone joins WiFi, that is Station mode. Your router is the host; the ESP is a guest. 📶
Include the Library
Everything starts by including the WiFi library. That one line gives you connect, status, and address functions.
#include <WiFi.h>Store Your Credentials
Save your network name and password in const char variables. Keeping them near the top makes them easy to update later.
const char* ssid = "MyNetwork";
const char* password = "secret123";SSID Is the Network Name
The SSID is simply the WiFi name you tap on your phone. It must match exactly, including capital letters and spaces.
Set the Mode
Tell the chip to act as a client with WiFi.mode(). Setting station mode keeps it from accidentally becoming its own hotspot.
WiFi.mode(WIFI_STA);Start the Connection
Kick things off with WiFi.begin(), passing your ssid and password. This starts the handshake with the router.
WiFi.begin(ssid, password);Connecting Takes Time
Joining is not instant. You wait in a loop and check WiFi.status() until it reports WL_CONNECTED.
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}Show Progress Dots
Printing a dot each loop gives friendly feedback. When the dots stop, your board has successfully joined the network.
Grab Your IP Address
Once connected, the router hands your board an IP address. Read it with WiFi.localIP() so you know how to reach the device.
Serial.println(WiFi.localIP());The IP Identifies the Device
That IP address is your board's home on the network. You type it in a browser later to open pages your ESP serves.
When It Will Not Connect
Stuck on dots forever? Double-check the password and SSID, and remember ESP boards only join 2.4 GHz networks, not 5 GHz.
Quick Check
After WiFi.begin runs, how do you confirm the board actually joined the network?
Recap
You joined a router in Station mode: include WiFi, set credentials, call begin, wait for WL_CONNECTED, then print your IP. 🎉
Preguntas frecuentes
¿La lección «Conectarse a WiFi en modo estación» es gratis?
Sí — el texto completo de «Conectarse a WiFi en modo estación» 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 «Conectarse a WiFi en modo estación»?
Conéctese a su red e imprima la dirección IP. 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 «Conectarse a WiFi en modo estación»?
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
- Por qué ESP32 y ESP8266 para IoT
- Añadir placas ESP al IDE
- Conectarse a WiFi en modo estación
- Ejecutar una página de configuración de punto de acceso