Add ESP32 connection check script

This commit is contained in:
Rudraa-25 2026-05-17 07:35:49 +05:30
parent 66db4ed9ba
commit a83956a8ac
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
"""
Simple script to check ESP32 connection status.
Run this to see if your ESP32 is connected to WiFi.
"""
import serial
import time
import sys
def check_esp32(port='COM5', baud=115200):
print(f"Checking ESP32 on {port} at {baud} baud...")
print("Press Ctrl+C to exit\n")
try:
ser = serial.Serial(port, baud, timeout=1)
time.sleep(2) # Wait for connection
# Read some output
for _ in range(20):
if ser.in_waiting:
line = ser.readline().decode('utf-8', errors='ignore').strip()
if line:
print(line)
time.sleep(0.5)
except serial.SerialException as e:
print(f"Error: {e}")
print("\nMake sure:")
print("1. ESP32 is connected to your PC via USB")
print("2. No other program is using the COM port")
print("3. You're using the correct COM port (e.g., COM5)")
if __name__ == "__main__":
port = sys.argv[1] if len(sys.argv) > 1 else 'COM5'
check_esp32(port)