Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views1 page

Wifi Testing

This document contains an Arduino sketch that sets up communication with an ESP8266 WiFi module using SoftwareSerial. It initializes the ESP8266, tests communication, and attempts to connect to a specified WiFi network. The code includes placeholders for the WiFi SSID and password, and provides feedback on the connection status through the Serial monitor.

Uploaded by

harshmali333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Wifi Testing

This document contains an Arduino sketch that sets up communication with an ESP8266 WiFi module using SoftwareSerial. It initializes the ESP8266, tests communication, and attempts to connect to a specified WiFi network. The code includes placeholders for the WiFi SSID and password, and provides feedback on the connection status through the Serial monitor.

Uploaded by

harshmali333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <SoftwareSerial.

h>

#define RX 2 // Arduino RX (Connects to ESP8266 TX)


#define TX 3 // Arduino TX (Connects to ESP8266 RX via voltage divider)

SoftwareSerial esp8266(RX, TX);

void setup() {
Serial.begin(9600);
esp8266.begin(115200); // ESP8266 Default Baud Rate

Serial.println("Connecting to WiFi...");

esp8266.println("AT"); // Test communication


delay(1000);
if (esp8266.find("OK")) {
Serial.println("ESP8266 Ready!");
} else {
Serial.println("ESP8266 NOT responding! Check wiring.");
}

// Connect to WiFi
esp8266.println("AT+CWMODE=1"); // Set ESP to Station mode
delay(1000);
esp8266.println("AT+CWJAP=\"YourWiFiSSID\",\"YourWiFiPassword\""); // Replace
with your WiFi SSID & Password
delay(5000);

if (esp8266.find("WIFI CONNECTED")) {
Serial.println("✅ Connected to WiFi!");
} else {
Serial.println("❌ Failed to connect. Check credentials.");
}
}

void loop() {}

You might also like