# esp32c3 **Repository Path**: sanzk/esp32c3 ## Basic Information - **Project Name**: esp32c3 - **Description**: SG90舵机控制 0~180°滑动旋转 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-22 - **Last Updated**: 2026-06-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ESP32-C3 WiFi Servo Control Project This is a WiFi servo control project based on the ESP32-C3, enabling remote servo angle control via the WebSocket protocol. ## Features - **WiFi Connection**: Supports connecting to WiFi networks by configuring SSID and password - **WebSocket Control**: Real-time servo angle control via the WebSocket protocol - **Web Interface**: Built-in HTML page for direct servo control via browser - **Pin Protection**: Built-in GPIO pin safety check to prevent usage of prohibited pins ## Hardware Requirements - ESP32-C3 development board - Servo motor (e.g., SG90) - Power supply ## Pin Definitions | Pin | Description | |-----|-------------| | GPIO 8/9 | Strapping pins, **disabled** | | GPIO 18/19 | USB pins, **disabled** | ## Usage ### 1. Configure WiFi Modify the following in `src/main.cpp`: ```cpp const char* ssid = "your_wifi_ssid"; const char* password = "your_wifi_password"; ``` ### 2. Configure Servo Pin Adjust the servo pin according to your actual wiring: ```cpp const int servoPin = your_servo_pin; // Avoid using GPIO 8, 9, 18, 19 ``` ### 3. Compile and Upload Use PlatformIO to compile and upload: ```bash pio run --target upload ``` ### 4. Control Methods 1. After the device connects to WiFi, access its IP address in a web browser 2. Use the slider on the web interface to control the servo angle 3. Or send an angle command via WebSocket: `{"angle": 90}` ## Project Structure ``` ├── platformio.ini # PlatformIO configuration file ├── src/ │ └── main.cpp # Main program code ├── include/ # Header files directory ├── lib/ # Library directory └── test/ # Test directory ``` ## Dependencies - Arduino framework - Servo library - WebSockets library ## License MIT License