+
+ Aphotoresistor is a resistor made by utilizing the photoelectric effect of semiconductors. The resistance value changes with
+ the intensity of incident light. It is also called a photodetector. When the incident light is strong, the resistance decreases.
+ Whenthe incident light is weak, the resistance increases. . There is another type where the resistance decreases when the
+ incident light is weak and when the incident light is strong, the resistance increases. According to this characteristic,
+ photoresistors with different shapes and irradiation areas can be manufactured.
+ Working principle: Since the carriers generated by illumination participate in conduction and drift under the action of the
+ external electric field, the electrons rush to the positive electrode of the power supply and the holes rush to the negative
+ electrode of the power supply, thus causing the resistance of the photoresistor to drop rapidly. Photoresistors are generally
+
+ used for light measurement, light control and photoelectric conversion .
+
+## 10.3 Connection lines
+
+
+
+## 10.4 Upload code program
+
+### 10.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 10.4.2 Open the program file (path: 2_ESP32_S3_PLUS \ Lesson_10_Photoresistor )
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+ After the program is uploaded, open the IDE serial port monitor and you can see the printed output light intensity value.
+ Under normal lighting, the value is a maximum of 4095
+ The detection value is <300 when covering the photoresistor with objects.
+
+## 10.5 Code analysis
+
+ The variable Lightvalue that defines the analog input pin analogInPin of the photoresistor detection module and the light
+ intensity value.
+
+ ```cpp
+const int analogInPin = 12; // The photoresistor mimics the input pin
+int Lightvalue = 0; // Defining variables
+```
+
+ Set the photosensitive detection module pin as input, baud rate 9600
+
+ ```cpp
+void setup() {
+ Serial.begin(9600); // Initialize the serial port baud rate
+ pinMode(analogInPin,INPUT);
+}
+```
+
+ The loop function first obtains the simulation value of the light detection module, saves it to a variable and prints it to the
+ serial monitor.
+
+```cpp
+void loop() {
+ Lightvalue = analogRead(analogInPin); // Read the value of light sensitivity
+ Serial.print("Lightvalue = "); // Print the value of light sensitivity through the serial port
+ Serial.println(Lightvalue);
+ delay(200);
+}
+
+ ```
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_11_Ultrasonic_ranging_OLED_display/Lesson_11_Ultrasonic_ranging_OLED_display.ino b/ESP32S3-Tutorial/example/Lesson_11_Ultrasonic_ranging_OLED_display/Lesson_11_Ultrasonic_ranging_OLED_display.ino
new file mode 100644
index 0000000..514009e
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_11_Ultrasonic_ranging_OLED_display/Lesson_11_Ultrasonic_ranging_OLED_display.ino
@@ -0,0 +1,57 @@
+#include
+
+ Sound waves are produced by vibrations and can travel at different speeds in different media. Ultrasonic waves have the
+ advantages of strong directivity, slow energy loss, and long propagation distance in media, and are often used for distance
+ measurement. For example, distance meters, liquid level measuring instruments, etc. can all be realized through ultrasonic
+ waves.
+
+|||
+|----|----|
+|Electrical parameters|HC-SR04 Ultrasonic module|
+|Working voltage|DC-5V|
+|Working current|15mA|
+|Working frequency|40KHz|
+|Maximum range|4m|
+|Minimum range|2cm|
+|Measuring angle|15°|
+|Input trigger signal|10 USTTLpulse|
+|Output echo signal|Output TTL level signal, proportional to the range|
+|||
+
+ Ultrasonic ranging is a non-contact detection method , especially used in airborne ranging. Because the wave speed in the
+ air is slow, the echo signal contained along the direction of structural information propagation is easy to detect and has very
+ high resolution, so it The accuracy is higher than other methods; the ultrasonic sensor has the characteristics of simple
+ structure, small size, and reliable signal processing. The use of ultrasonic detection is often faster, more convenient, simpler
+ to calculate, easier to achieve real-time control, and can meet industrial practical requirements in terms of measurement
+ accuracy.
+
+ There are many methods of ultrasonic ranging. The principle of this system in ultrasonic measurement is: the trigger signal
+ input terminal ( TRIG ) will input a high-level signal of more than 10 microseconds.After receiving the signal, the
+ ultrasonic transmitter will automatically send 8 A 40Hz square wave.At the same time, the timer will start. When the sensor
+ receives the echo, it stops timing and outputs the echo signal. Detect the ultrasonic wave from the ultrasonic transmitter, the
+ transmission time through the gas medium to the receiver , multiply this time by the speed of sound in the gas, and get the
+ distance of sound propagation. That is, the ultrasonic transmitter emits ultrasonic waves in a certain direction, and the MCU
+ starts timing at the same time. The ultrasonic waves are launched in the air and return immediately when encountering
+ obstacles on the way. The ultrasonic receiver stops timing immediately after receiving the reflected waves.
+ Trecorded by the timer , the distance ( s ) from the launch point to the obstacle can be calculated .
+
+ **Formula: S = VT/2**
+
+ Four factors limit the maximum measurable distance of an ultrasound system: the amplitude of the ultrasound wave, the
+ texture of the reflector, the angle between the reflected and incident sound waves, and the sensitivity of the receiving
+ transducer. The ability of the receiving transducer to directly receive the acoustic pulse will determine the minimum
+ measurable distance.
+
+### 11.2.2 OLED
+
+
+
+ 1. Resolution: 128*64
+ 2. Super wide viewing angle: greater than 160
+ 3. Communication method: IIC
+ 4. Working voltage: 3.3V~5V
+
+## 11.3 Connection lines
+
+
+
+## 11.4 Upload code program
+
+### 11.4.1 Connect the main control board to the computer with a USB cable
+
+
+
+### 11.4.2 Open the program file ( path : 2_ESP32_S3_PLUS \ Lesson_11_Ultrasonic_ranging_OLED_display )
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+ After the program is uploaded, use an object to block the ultrasonic wave and see the measured distance value ( when the
+ screen does not display correctly, you need to check the SCL/SDAwiring, or press the motherboard reset button to reset the
+ program ).
+
+
+
+## 11.5 Code analysis
+
+Declare the required libraries. If the corresponding libraries are not added, please go back to the installation libraryto see how to add the libraries.
+
+```cpp
+#include
+
+- **humidity:**
+- **Resolution:** 16Bit
+- **Resolution:** ±1% RH
+- **Accuracy:** ±5% RH at 25℃
+- **Interchangeability:** Interchangeable
+- **Response time:** 6S under 1/e(63%) 25℃, 1m/s air condition
+- **Hysteresis:** <±0.3% RH
+- **Long-term stability:** <±0.5% RH/year
+
+**temperature:**
+
+ |||||
+ |----|----|----|----|
+ |**Resolution**|±2℃|**Lag**|<±0.3% RH|
+ |**Repeatability**|±0.2℃|**Response time**|10S at 1/e (63%) condition|
+ |**Interchangeability**|Interchangeable||||
+ |||||
+
+## 12.3 Connection lines
+
+
+
+## 12.4 Upload code program
+
+### 12.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 12.4.2 Open the program file (path: 2_ESP32_S3_PLUS\ Lesson _ 12_DHT11_OLED_display )
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+ After the program is uploaded, you will see the temperature and humidity values ( when the screen does not display
+ correctly, you need to check the SCL/SDAwiring, or press the motherboard reset button to reset the program ).
+
+
+
+### 12.5 Code analysis
+ Declare the required library files. If the corresponding library is not added, please go back to the installation library
+ to see
+ how to add the library.
+
+```cpp
+#include
+
+
+
+## 13.3 Connection lines
+
+
+
+## 13.4 Upload code program
+
+### 13.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 13.4.2 Open the program file ( Path : 2_ESP32_S3_PLUS \ Lesson_13_Infrared_change_RGB )
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+
+ After the program is uploaded, point the infrared remote control at the infrared receiver and press the number keys 1/2/3 to
+ control the WS2812 to switch lights of different colors.
+
+## 13.5 Code analysis
+
+ Declare the required library files. If the corresponding library is not added, please go back to the installation library
+ to see
+ how to add the library.
+
+```cpp
+/* esp32 by espressif system 라이브러리 필요 v2.0.17 빌드 가능
+ Irecv 이슈
+*/
+
+#include + + LED Off +
++ + LED Off +
++ + LED Off +
+ + + +)rawliteral"; + +String getLEDState() { + String json; + json += "{\"greenColor\":\"" + String(greenLEDState == HIGH ? "#66CC33" : "#808080") + "\","; + json += "\"yellowColor\":\"" + String(yellowLEDState == HIGH ? "#FFCC33" : "#808080") + "\","; + json += "\"redColor\":\"" + String(redLEDState == HIGH ? "#FF0000" : "#808080") + "\","; + json += "\"greenText\":\"" + String(greenLEDState == HIGH ? "LED ON" : "LED OFF") + "\","; + json += "\"yellowText\":\"" + String(yellowLEDState == HIGH ? "LED ON" : "LED OFF") + "\","; + json += "\"redText\":\"" + String(redLEDState == HIGH ? "LED ON" : "LED OFF") + "\"}"; + return json; +} + +void setup() { + Serial.begin(9600); // Set the serial port baud rate + + //Set the pin output mode + pinMode(greenLEDPin, OUTPUT); + pinMode(yellowLEDPin, OUTPUT); + pinMode(redLEDPin, OUTPUT); + + //Set the state of the LED + digitalWrite(greenLEDPin, greenLEDState); + digitalWrite(yellowLEDPin, yellowLEDState); + digitalWrite(redLEDPin, redLEDState); + + // Setting up WiFi connection + WiFi.begin(ssid, password); + Serial.println("WiFi Setting"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + // Printing IP addresses + Serial.println(WiFi.localIP()); + + // Set up the request handler function + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html); + }); + server.on("/toggle", HTTP_GET, [](AsyncWebServerRequest *request) { + String color = request->getParam("color")->value(); + if (color == "green") { + greenLEDState = !greenLEDState; + digitalWrite(greenLEDPin, greenLEDState); + } else if (color == "yellow") { + yellowLEDState = !yellowLEDState; + digitalWrite(yellowLEDPin, yellowLEDState); + } else if (color == "red") { + redLEDState = !redLEDState; + digitalWrite(redLEDPin, redLEDState); + } + request->send(200, "application/json", getLEDState()); + }); + server.on("/ledstate", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send(200, "application/json", getLEDState()); + }); + + // Starting the server + server.begin(); +} + +void loop() { + // AsyncWebServer +} diff --git a/ESP32S3-Tutorial/example/Lesson_14_Web_key_controls_LED/README.md b/ESP32S3-Tutorial/example/Lesson_14_Web_key_controls_LED/README.md new file mode 100644 index 0000000..abc8086 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_14_Web_key_controls_LED/README.md @@ -0,0 +1,143 @@ +# 14. Webswitch control LED + +## 14.1 Overview + This section focuses on learning the WiFi function of ESP32S3 and controlling the LED on the web page. + +## 14.2 Working principle + + Connect to a WiFi hotspot with smooth network through ESP32, and then use other devices such as computers or mobile + phones to connect to the same WiFi. Enter the IP in the browser address bar to open the web interface created by ESP32, + and control it through the web page containing the LED switch. LED. + +
+
+## 14.3 Connection lines
+
+
+
+## 14.4 Upload code program
+
+### 14.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 14.4.2 Open the program file (path: 2_ESP32_S3_PLUS \ Lesson_14_Web_key_controls_LED )
+
+ Modify the WiFi account and password to which ESP32 is connected in the code. (This WiFi can be the router WiFi at home
+ or the WiFi transmitted by the mobile hotspot, but make sure it is 2.4G and not 5G)
+
+```cpp
+const char *ssid = "xxxxxxx"; // Enter the WiFi account to which your ESP32 will connect
+const char *password = "xxxxxxx"; //Set WiFi password
+```
+
+ Then select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+ After the program upload is completed, open the serial monitor to view the IP address.
+ Here the IP is 192.168.8.1, but everyone will get a different IP.
+ Connect to the same WiFi with your mobile phone, then open the browser, enter the IP address above and enter the page.
+ Click the icon to control the corresponding LED switch.
+
+ ## 14.5 Code analysis
+
+ Declare the required libraries primarily for creating web services and handling asynchronous event-driven models
+
+```cpp
+#include Green:
"; + html += "Yellow:
"; + html += "Red:
"; + html += "Red:
"; + html += "Green:
"; + html += "Blue:
"; + html += "+ + Temperature + %TEMPERATURE% + °C +
++ + Humidity + %HUMIDITY% + % +
+ + +)rawliteral"; + +String processor(const String &var) { + if (var == "TEMPERATURE") { // 如果请求的变量是"TEMPERATURE" If the request variable is "TEMPERATURE" + return String(t); // 返回当前温度值的字符串形式 Returns the current temperature as a string + } else if (var == "HUMIDITY") { // 如果请求的变量是"HUMIDITY" If the requested variable is "HUMIDITY" + return String(h); // 返回当前湿度值的字符串形式 Returns the current humidity value as a string + } + return String(); // 如果请求的变量不是"TEMPERATURE"或"HUMIDITY",则返回空字符串 If the requested variable is not "TEMPERATURE" or "HUMIDITY", an empty string is returned +} + +void setup() { + Serial.begin(9600); + dht.begin(); // 初始化DHT11 Initialize DHT11 + + // 设置 WiFi 连接 Setting up WiFi connection + WiFi.begin(ssid, password); + Serial.println("Connecting to WiFi"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + + Serial.println(WiFi.localIP()); //打印IP地址 Printing IP addresses + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html, processor); + }); + server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request) { + float newT = dht.readTemperature(); + if (isnan(newT)) { + request->send(500, "text/plain", "Failed to read temperature from DHT sensor!"); + } else { + request->send_P(200, "text/plain", String(newT).c_str()); + } + }); + server.on("/humidity", HTTP_GET, [](AsyncWebServerRequest *request) { + float newH = dht.readHumidity(); + if (isnan(newH)) { + request->send(500, "text/plain", "Failed to read humidity from DHT sensor!"); + } else { + request->send_P(200, "text/plain", String(newH).c_str()); + } + }); + + // 启动服务器 + server.begin(); +} + +void loop() { + unsigned long currentMillis = millis(); //获取当前的毫秒数,用于记录当前时间。 Gets the current number of milliseconds, which is used to record the current time. + if (currentMillis - previousMillis >= interval) { //检查是否已经到达了指定的时间间隔,如果是则执行下面的代码。 Check to see if the specified interval has been reached, and if so execute the following code: + previousMillis = currentMillis; //更新上一次执行的时间,以便下一次判断时间间隔。 Update the time of the last execution so that the next time interval is determined. + float newT = dht.readTemperature(); //读取温度传感器的数据,并将读取到的值存储在newT变量中。 The data of the temperature sensor is read and the value read is stored in the newT variable. + if (isnan(newT)) { //检查读取的温度值是否为非数字(NaN),如果是则输出错误信息。 Check if the temperature is not a number (NaN) and print an error if it is. + Serial.println("Failed to read temperature from DHT sensor!"); + } else { + t = newT; //将读取到的温度值赋给t变量 Assign the temperature to the t variable + Serial.println(t); //打印输出温度 Print output temperature + } + float newH = dht.readHumidity(); //读取湿度传感器的数据,并将读取到的值存储在newH变量中 Read the humidity sensor data and store the read value in the newH variable + if (isnan(newH)) { //检查读取的湿度值是否为非数字(NaN),如果是则输出错误信息 Check if the humidity value is not a NaN and print an error if it is + Serial.println("Failed to read humidity from DHT sensor!"); + } else { + h = newH; //将读取到的湿度值赋给h变量 The read humidity value is assigned to the h variable + Serial.println(h); //打印输出湿度 Print output humidity + } + } +} diff --git a/ESP32S3-Tutorial/example/Lesson_17_Web_Display_temperature_and_humidity/README.md b/ESP32S3-Tutorial/example/Lesson_17_Web_Display_temperature_and_humidity/README.md new file mode 100644 index 0000000..4287ca8 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_17_Web_Display_temperature_and_humidity/README.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/Lesson_18_Web_server_control_buzzer_alarm.ino b/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/Lesson_18_Web_server_control_buzzer_alarm.ino new file mode 100644 index 0000000..9d50f81 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/Lesson_18_Web_server_control_buzzer_alarm.ino @@ -0,0 +1,98 @@ +#include+ + Buzzer Control +
+ + +)rawliteral"; + +void setup() { + Serial.begin(9600); + pinMode(buzzerPin, OUTPUT); // 设置引脚工作模式为输出 Set the pin operation mode to output + digitalWrite(buzzerPin, LOW); // 蜂鸣器初始设置关闭 The initial setting of the buzzer is off + + // 设置 WiFi 连接 Setting up WiFi connection + WiFi.begin(ssid, password); + Serial.println("Connecting to WiFi"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + + Serial.println(WiFi.localIP()); //打印IP地址 Printing IP addresses + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html); + }); + + server.on("/toggleBuzzer", HTTP_GET, [](AsyncWebServerRequest *request) { + if (isBuzzerOn) { + digitalWrite(buzzerPin, LOW); // 关闭蜂鸣器 Turn off the buzzer + isBuzzerOn = false; + } else { + digitalWrite(buzzerPin, HIGH); // 打开蜂鸣器 Turn on the buzzer + isBuzzerOn = true; + } + request->send(200, "text/plain", "Buzzer toggled"); + }); + + //启用服务器 Enabling the server + server.begin(); +} + +void loop() { + //在这里添加任何需要持续运行的额外代码 +} diff --git a/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/README.md b/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/README.md new file mode 100644 index 0000000..4287ca8 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_18_Web_server_control_buzzer_alarm/README.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/Lesson_19_Photoresistor_controls_LED.ino b/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/Lesson_19_Photoresistor_controls_LED.ino new file mode 100644 index 0000000..1ce062a --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/Lesson_19_Photoresistor_controls_LED.ino @@ -0,0 +1,113 @@ +#include+ + LED OFF +
++ + Brightness + %BRIGHTNESS% + % +
+When the light intensity is below 70%, the LED will be turned on.
+ + + +)rawliteral"; + +void setup() { + Serial.begin(9600); + pinMode(ledPin, OUTPUT); // 定义引脚工作模式 Define the pin operation mode + digitalWrite(ledPin, LOW); // 确保LED初始状态为关闭 Ensure that the LED is initially off + pinMode(ldrPin, INPUT); // 设置光敏电阻引脚为输入模式 Set the photoresistor pin to input mode + + // 设置 WiFi 连接 Setting up WiFi connection + WiFi.begin(ssid, password); + Serial.println("Connecting to WiFi"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + + Serial.println(WiFi.localIP()); //打印IP地址 Printing IP addresses + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html); + }); + + server.on("/brightness", HTTP_GET, [](AsyncWebServerRequest *request) { + int sensorValue = analogRead(ldrPin); // 读取光敏电阻的值(0-4095之间) Read photoresistor values (0-4095) + int brightnessPercentage = map(sensorValue, 0, 4095, 0, 100); // 将值映射到百分比范围(0-100) Map values to a percentage range (0-100) + String brightnessString = String(brightnessPercentage); // 将百分比转换为字符串 Convert percentages to strings + request->send(200, "text/plain", brightnessString); // 发送亮度百分比到客户端 Send the brightness percentage to the client + + if (sensorValue < threshold) { //如果检测到亮度低于70% If the brightness is detected below 70% + digitalWrite(ledPin, HIGH); //点亮LED灯 Light up the LED + } else { //否则 otherwise + digitalWrite(ledPin, LOW); //熄灭LED灯 Turn off the LED lights + } + }); + + //启用服务器 + server.begin(); +} + +void loop() { +} diff --git a/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/README.md b/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/README.md new file mode 100644 index 0000000..4287ca8 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_19_Photoresistor_controls_LED/README.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/Lesson_20_Web_control_steering_gear_Angle_display.ino b/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/Lesson_20_Web_control_steering_gear_Angle_display.ino new file mode 100644 index 0000000..9fb703b --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/Lesson_20_Web_control_steering_gear_Angle_display.ino @@ -0,0 +1,131 @@ +#include+ + Servo Angle: 90 +
++ +
+ + + +)rawliteral"; + +void setup() { + Serial.begin(9600); + Wire.begin(5, 4); //初始化 I2C 总线 SDA引脚设置为5,SCL引脚设置为4 The initial I2C bus SDA pin is set to 5 and the SCL pin is set to 4 + + // 初始化屏幕 + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + Serial.println(F("SSD1306 initialization failed")); + for (;;) + ; + } + + display.clearDisplay(); + // 初始化显示舵机角度 Initialize display steering Angle + display.setTextSize(2); + display.setTextColor(SSD1306_WHITE); + display.setCursor(0, 8); + display.println("SG90 Angle"); + display.setCursor(32, 40); + display.print("0"); + display.display(); + + servo.attach(servoPin); //关联舵机引脚 Associate servo pin + // 设置 WiFi 连接 + WiFi.begin(ssid, password); + Serial.println("Connecting to WiFi"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + Serial.println(WiFi.localIP()); //打印IP地址 + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html); + }); + + server.on("/servo", HTTP_GET, [](AsyncWebServerRequest *request) { + if (request->hasParam("angle")) { + int angle = request->getParam("angle")->value().toInt(); + servo.write(angle); + display.clearDisplay(); + + // 显示舵机角度 Display steering Angle + display.setTextSize(2); + display.setTextColor(SSD1306_WHITE); + display.setCursor(0, 8); + display.println("SG90 Angle"); + display.setCursor(32, 40); + display.print(angle); + display.display(); + request->send(200, "text/plain", "OK"); + } else { + request->send(400, "text/plain", "Missing angle parameter"); + } + }); + + //启用服务器 + server.begin(); +} + +void loop() { +} diff --git a/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/README.md b/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/README.md new file mode 100644 index 0000000..4287ca8 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_20_Web_control_steering_gear_Angle_display/README.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/Lesson_21_Web_control_ultrasonic_ranging_display.ino b/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/Lesson_21_Web_control_ultrasonic_ranging_display.ino new file mode 100644 index 0000000..b536bf9 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/Lesson_21_Web_control_ultrasonic_ranging_display.ino @@ -0,0 +1,159 @@ +#include+ + Distance: -- cm +
+ + + +)rawliteral"; + +float GetDistance() //获取超声波传感器数值 Get ultrasonic sensor values +{ + float distance; + //发送一个低短脉冲到Trig触发测距 + digitalWrite(Trig, LOW); //发送一个低电平到Trig + delayMicroseconds(2); + digitalWrite(Trig, HIGH); + delayMicroseconds(10); + digitalWrite(Trig, LOW); + distance = pulseIn(Echo, HIGH) / 58.00; + //Serial.print("Distance = "); + //Serial.println(distance); //串行输出距离转换成厘米 + delay(10); + return distance; +} + +void setup() { + Serial.begin(9600); + pinMode(Trig, OUTPUT); //定义引脚工作模式为输入 Define the pin operation mode as the input + pinMode(Echo, INPUT); //定义引脚工作模式为输出 Define the pin operation mode as output + Wire.begin(5, 4); //初始化 I2C 总线 SDA引脚设置为5,SCL引脚设置为4 The initial I2C bus SDA pin is set to 5 and the SCL pin is set to 4 + + // 初始化屏幕 Initializing the screen + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + Serial.println(F("SSD1306 initialization failed")); + for (;;) + ; + } + + // 清空屏幕缓冲区 Clear the screen buffer + display.clearDisplay(); + + // 显示超声波距离 Display ultrasonic distance + display.setTextSize(2); + display.setTextColor(SSD1306_WHITE); + display.setCursor(16, 8); + display.println("Distance"); + display.setCursor(16, 40); + display.print("0"); + display.print(" cm"); + display.display(); + + // 设置 WiFi 连接 Setting up WiFi connection + WiFi.begin(ssid, password); + Serial.println("Connecting to WiFi"); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("."); + } + + Serial.println(WiFi.localIP()); //打印IP地址 + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send_P(200, "text/html", index_html); + }); + + server.on("/ultrasonic", HTTP_GET, [](AsyncWebServerRequest *request) { + float distance = GetDistance(); + if (distance >= 400 || distance <= 2) { + distance = -1; // 超出范围或错误值 + } + request->send(200, "text/plain", String(distance)); + + // 清空屏幕缓冲区 + display.clearDisplay(); + + // 显示超声波距离 + display.setTextSize(2); + display.setTextColor(SSD1306_WHITE); + display.setCursor(16, 8); + display.println("Distance"); + display.setCursor(16, 40); + display.print(distance); + display.print(" cm"); + display.display(); + }); + + //启用服务器 + server.begin(); +} + +void loop() { +} diff --git a/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/README.md b/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/README.md new file mode 100644 index 0000000..4287ca8 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_21_Web_control_ultrasonic_ranging_display/README.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/Lesson_2_Light_up_the_LED.ino b/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/Lesson_2_Light_up_the_LED.ino new file mode 100644 index 0000000..41f9516 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/Lesson_2_Light_up_the_LED.ino @@ -0,0 +1,12 @@ +#define LED 13 // Define the LED lamp output pin + +void setup() { + pinMode(LED, OUTPUT); // Define the operation mode of the pin + digitalWrite(LED, LOW); // Output low level +} + +void loop() { + // Because the negative electrode of the LED lamp is already connected to the GND, + // it only needs to output a high level to run and light the LED lamp + digitalWrite(LED, HIGH); +} diff --git a/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/REAMDE.md b/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/REAMDE.md new file mode 100644 index 0000000..9524da3 --- /dev/null +++ b/ESP32S3-Tutorial/example/Lesson_2_Light_up_the_LED/REAMDE.md @@ -0,0 +1,79 @@ +# 2. Light up the LED + +## 2.1.Overview + + This section mainly focuses on understanding the characteristics of the main control board and expansion board, learning + how to burn code and lighting the green LED on the expansion board through the program. + +## 2.2.Control board resources + +### 2.2.1.ESP32-S3-PLUS main control board +* All I/O ports provided by the main control board support PWM; +* Some I/O second functions also support SPI/IIC/clock output and other functions; +* Tpye-C input voltage is 5V; +* DCinput voltage 7V~9V + +
+
+### 2.2.2 Expansion board
+
+
+
+## 2.3.Connect the line
+
+
+
+## 2.4. Upload code program
+
+### 2.4.1. Connect the main control board to the computer with a USB cable
+
+
+
+### 2.4.2. Open the " 2_ESP32_S3_PLUS \Lesson_2_Light_up_the_LED" code file
+
+Select the board type as ESP32S3 Dev Module. When plugging in the USB, a new COM number will be displayed. Select it.
+
+Here it is COM(x), but the actual COM number will be different for everyone.
+
+
+
+ Click "Upload" to start compiling and uploading the program to the main control board.
+ Waiting for the program to upload;
+
+ After the program upload is completed , you can see that the green light of LED2 is on.
+
+## 2.5. Code analysis
+ this " sketch " code consists of comments. These are not actual program instructions; instead, they simply explain how to
+ make the program work. They are there for your ease of reading . Everything between " /* " and " */ " at the top of the
+ sketch is a block comment that explains the purpose of the sketch.
+ Single-line comments begin with "//" and everything up to the end of the line is considered a comment.
+
+The first part of the code is:
+
+```cpp
+#define LED 13 // Define the LED lamp output pin
+
+void setup() {
+ pinMode(LED, OUTPUT); // Define the operation mode of the pin
+ digitalWrite(LED, LOW); // Output low level
+}
+```
+
+
+ * Every sketch requires a "set" function , which is a "void setup()" function, this is executed when the reset button is
+ pressed.
+ * It is executed whenever the board resets for any reason, such as first power-up or after uploading a sketch.
+ * The next step is to name the pin and set the output. Here, set " LED " as the output port, and digitalWrite(LED,LOW)
+ controls the pin to output a low level, which is to turn off.
+ *The sketch must also have a " loop " function. Unlike the "Set " function, which only runs once , after a reset, the "Loop "
+ function will start again immediately after completing the command run.
+
+```cpp
+void loop() {
+ // Because the negative electrode of the LED lamp is already connected to the GND,
+ // it only needs to output a high level to run and light the LED lamp
+ digitalWrite(LED, HIGH);
+}
+```
+
+ Inside the loop function, the command turns on the LED ( high )
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/Lesson_3_Button_control_LED.ino b/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/Lesson_3_Button_control_LED.ino
new file mode 100644
index 0000000..146a417
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/Lesson_3_Button_control_LED.ino
@@ -0,0 +1,31 @@
+//2025.07.04
+//#define button 46 문제있어서 gpio 13으로 바꿈
+#define LED 13
+#define button 8
+
+int key_ok = 0; //Define the data variables needed for the project
+int LED_en = 0;
+
+void setup() {
+ pinMode(button, INPUT); //Define the operation mode of the pin
+ pinMode(LED, OUTPUT);
+}
+
+void loop() {
+ // Determine if a button has been pressed and read the button level
+ if (digitalRead(button)) {
+ if (key_ok) // Determine if the button is pressed
+ {
+ key_ok = 0;
+ if (LED_en) LED_en = 0; // Determines whether the last flag bit is established
+ else LED_en = 1;
+ }
+ } else {
+ delay(20);
+ if (!digitalRead(button)) key_ok = 1;
+ }
+
+ // When the key is pressed, the level of the LED light output pin is reversed
+ if (LED_en) digitalWrite(LED, HIGH);
+ else digitalWrite(LED, LOW);
+}
diff --git a/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/README.md b/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/README.md
new file mode 100644
index 0000000..8f750ac
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_3_Button_control_LED/README.md
@@ -0,0 +1,83 @@
+# 3. Button control LED
+
+## 3.1.Overview
+ This section focuses on learning how to use buttons to control LEDs to implement the delay control function.
+
+## 3.2. Working principle
+ The key signal pin S has a pull-up resistor by default, so it is high level and changes to low level when the key is pressed. At
+ this time, the input of pin 46 of the main control board is low level. By judging the pin status as a condition, the LED pin
+ level is flipped, thereby controlling the LED to turn on and off.
+
+### 3.2.1.LED
+
+
+
+ LED(Light Emitting Diode), which converts electrical energy into light energy, also has one-way conductivity and a
+ reverse breakdown voltage of about 5v. Its forward volt-ampere characteristic curve is very steep. In the development board,
+ the negative electrodes of the LEDs are all common to the ground. When the signal pin is set to high level , the LED is on,
+ and when it is set to low level , the LED is turned off.
+
+## 3.3.Connect the lines
+
+
+
+## 3.4.Upload code
+
+### 3.4.1. Connect the main control board to the computer with a USB cable
+
+
+
+### 3.4.2. Open the program file (path: 2_ESP32_S3_PLUS \ Lesson_3_Button_control_LED )
+
+ Also select the board type as ESP32S3 Dev Module, and select the COM number that is newly displayed when the USB is
+
+ plugged in. In this case, it is COM29, but the actual COM number will be different for everyone.
+ Click "Upload" to start compiling and uploading the program to the main control board.
+ Wait for the program upload to complete .
+
+ Press the button to light up LED2, press it again to turn off LED2 , and repeat the above effect.
+
+## 3.5. Code analysis
+ First define the led pin , button pin and define two variables
+
+```cpp
+#define LED 13
+#define button 8
+
+int key_ok = 0; //Define the data variables needed for the project
+int LED_en = 0;
+```
+
+Set the button pin as input and the LED pin as output
+
+```cpp
+void setup() {
+ pinMode(button, INPUT); //Define the operation mode of the pin
+ pinMode(LED, OUTPUT);
+}
+```
+
+ Obtain the button status within the loop structure, use the if...else... statement to determine whether the button is pressed or
+ released, implement the debounce function for the button status variable key_ok, and reverse the LED_en state when the
+ button is released, thus affecting the LED Write high and low levels to make the LED turn on or off.
+
+ ```cpp
+ void loop() {
+ // Determine if a button has been pressed and read the button level
+ if (digitalRead(button)) {
+ if (key_ok) // Determine if the button is pressed
+ {
+ key_ok = 0;
+ if (LED_en) LED_en = 0; // Determines whether the last flag bit is established
+ else LED_en = 1;
+ }
+ } else {
+ delay(20);
+ if (!digitalRead(button)) key_ok = 1;
+ }
+
+ // When the key is pressed, the level of the LED light output pin is reversed
+ if (LED_en) digitalWrite(LED, HIGH);
+ else digitalWrite(LED, LOW);
+}
+ ```
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/Lesson_4_active_buzzer.ino b/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/Lesson_4_active_buzzer.ino
new file mode 100644
index 0000000..ba1e3b4
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/Lesson_4_active_buzzer.ino
@@ -0,0 +1,11 @@
+#define Buzzer 21 // Define the active buzzer pin
+void setup() {
+ pinMode(Buzzer, OUTPUT); // Define the pin as the output working mode
+}
+
+void loop() {
+ digitalWrite(Buzzer, HIGH);
+ delay(500);
+ digitalWrite(Buzzer, LOW);
+ delay(500);
+}
diff --git a/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/README.md b/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/README.md
new file mode 100644
index 0000000..ccffed0
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_4_active_buzzer/README.md
@@ -0,0 +1,54 @@
+# 4. Active buzzer
+
+## 4.1.Overview
+ The electronic buzzer is DC powered and equipped with an integrated circuit. They are widely used in computers, printers,
+ copiers, alarms, electronic toys, automotive electronic equipment, telephones, timers and other electronic products for voice
+ equipment. Buzzers can be divided into active buzzers and passive buzzers. Turn the two buzzer pins upward. The one with
+ the green circuit board is the passive buzzer, and the other one sealed with black tape is the active buzzer. In this section you
+ will learn how to use an active buzzer to generate a sound that sounds for half a second and then stops for half a second.
+
+## 4.2. Working principle
+
+### 4.2.1. Active buzzer
+ An active buzzer has an internal oscillation source, and it can sound as long as it is given a high level. Use the delay
+ function to make the buzzer sound regularly
+
+
+
+## 4.3.Connect lines
+
+
+
+## 4.4.Upload code
+
+### 4.4.1. Connect the main control board to the computer using a USB cable
+
+
+
+### 4.4.2. Open the program file (path: 2_ESP32_S3_PLUS\ Lesson_4_active_buzzer )
+
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board.
+
+## 4.5. Code analysis
+
+ Define the buzzer pin and set the buzzer as an output
+
+ ```cpp
+#define Buzzer 21 // Define the active buzzer pin
+void setup() {
+ pinMode(Buzzer, OUTPUT); // Define the pin as the output working mode
+}
+ ```
+
+ The buzzer pin is at a high level for 500 milliseconds and then at a low level for 500 milliseconds to achieve a "beep" sound
+ effect at intervals.
+
+ ```cpp
+ void loop() {
+ digitalWrite(Buzzer, HIGH);
+ delay(500);
+ digitalWrite(Buzzer, LOW);
+ delay(500);
+}
+ ```
diff --git a/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/Lesson_5_Traffic_light.ino b/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/Lesson_5_Traffic_light.ino
new file mode 100644
index 0000000..eafc28a
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/Lesson_5_Traffic_light.ino
@@ -0,0 +1,53 @@
+#define Green 13 // Define the green light pin
+#define Yellow 11 // Define the yellow light pin
+#define red 10 // Define the red light pin
+
+void setup() {
+ // Define the pin as the output working mode
+ pinMode(Green, OUTPUT);
+ pinMode(Yellow, OUTPUT);
+ pinMode(red, OUTPUT);
+}
+
+void loop() {
+ digitalWrite(Green, HIGH); // Turn on the green light
+ digitalWrite(Yellow, LOW); // Put out the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(5000); // Turn on the green light for five seconds
+
+ // The green light flashes every 500 milliseconds
+ digitalWrite(Green, HIGH);
+ delay(500);
+ digitalWrite(Green, LOW);
+ delay(500);
+ digitalWrite(Green, HIGH);
+ delay(500);
+ digitalWrite(Green, LOW);
+ delay(500);
+ digitalWrite(Green, HIGH);
+ delay(500);
+
+ // The yellow light is on for 1 second
+ digitalWrite(Green, LOW);
+ digitalWrite(Yellow, HIGH);
+ digitalWrite(red, LOW);
+ delay(1200);
+
+ // The red light stays on for 5 seconds
+ digitalWrite(Green, LOW);
+ digitalWrite(Yellow, LOW);
+ digitalWrite(red, HIGH);
+ delay(5000);
+
+ // The red light flashes every 500 milliseconds
+ digitalWrite(red, HIGH);
+ delay(500);
+ digitalWrite(red, LOW);
+ delay(500);
+ digitalWrite(red, HIGH);
+ delay(500);
+ digitalWrite(red, LOW);
+ delay(500);
+ digitalWrite(red, HIGH);
+ delay(500);
+}
diff --git a/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/README.md b/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/README.md
new file mode 100644
index 0000000..b2b4efc
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_5_Traffic_light/README.md
@@ -0,0 +1,110 @@
+# 5. Traffic lights
+
+## 5.1 Overview
+ In this section, you will learn to light multiple LEDs and control the green, yellow, and red lights to light up at intervals
+ through a delay function to achieve the effect of a traffic light.
+
+## 5.2. Working principle
+
+
+
+ There are three colors of traffic lights, green light, yellow light and red light. The pins connected to the main control board
+ are 13/11/10. By controlling the high level of the three pins, the corresponding lights can be lit. A single light cycle is as
+ follows: first let the green light be on for a period of time, which means that the traffic is in a passable state, then flash a
+ reminder before the green light ends and switch to the yellow light, then switch to the yellow light, and wait for a short
+ period of time before switching to the yellow light. Switch to red light. The red light also waits for a period of time,
+ indicating that traffic is prohibited from passing, and flashes as a reminder before the red light ends and is ready to switch to
+ the green light.
+ So the single-cycle process is roughly as follows:
+ Leave the green light on for five seconds , the green light flashing every 500 milliseconds, the yellow light on for 1 second,
+
+
+ the red light on for 5 seconds, the red light flashing every 500 milliseconds, and so on.
+
+## 5.3 Connection lines
+
+
+
+## 5.4 Upload code
+
+### 5.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 5.4.2 Open the program file (path: 2_ESP32_S3_PLUS\ Lesson_5_Traffic_light )
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+
+ in . Then click "Upload" to start compiling and uploading the program to the main control board.
+
+## 5.5 Code analysis
+
+ Define three LED pins
+
+```cpp
+#define Green 13 // Define the green light pin
+#define Yellow 11 // Define the yellow light pin
+#define red 10 // Define the red light pin
+```
+
+ Set pin as output
+
+```cpp
+void setup() {
+ // Define the pin as the output working mode
+ pinMode(Green, OUTPUT);
+ pinMode(Yellow, OUTPUT);
+ pinMode(red, OUTPUT);
+}
+```
+
+ The loop function executes a single light cycle.
+
+ The red light first lights up for 5 seconds and then flashes every 500 milliseconds.
+```cpp
+ void loop() {
+ digitalWrite(Green, HIGH); // Turn on the green light
+ digitalWrite(Yellow, LOW); // Put out the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(5000); // Turn on the green light for five seconds
+
+ // The green light flashes every 500 milliseconds
+ digitalWrite(Green, HIGH);
+ delay(500);
+ digitalWrite(Green, LOW);
+ delay(500);
+ digitalWrite(Green, HIGH);
+ delay(500);
+ digitalWrite(Green, LOW);
+ delay(500);
+ digitalWrite(Green, HIGH);
+ delay(500);
+```
+Yellow light on for 1 second
+```cpp
+ // The yellow light is on for 1 second
+ digitalWrite(Green, LOW);
+ digitalWrite(Yellow, HIGH);
+ digitalWrite(red, LOW);
+ delay(1200);
+```
+
+Finally, the red light turns on for 5 seconds and then flashes every 500 milliseconds
+```cpp
+// The red light stays on for 5 seconds
+ digitalWrite(Green, LOW);
+ digitalWrite(Yellow, LOW);
+ digitalWrite(red, HIGH);
+ delay(5000);
+
+// The red light flashes every 500 milliseconds
+ digitalWrite(red, HIGH);
+ delay(500);
+ digitalWrite(red, LOW);
+ delay(500);
+ digitalWrite(red, HIGH);
+ delay(500);
+ digitalWrite(red, LOW);
+ delay(500);
+ digitalWrite(red, HIGH);
+ delay(500);
+```
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_6_Flow_light/Lesson_6_Flow_light.ino b/ESP32S3-Tutorial/example/Lesson_6_Flow_light/Lesson_6_Flow_light.ino
new file mode 100644
index 0000000..beb664c
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_6_Flow_light/Lesson_6_Flow_light.ino
@@ -0,0 +1,29 @@
+#define Green 13 // Define the green light pin
+#define Yellow 11 // Define the yellow light pin
+#define red 10 // Define the red light pin
+
+void setup() {
+ // Define the pin as the output working mode
+ pinMode(Green, OUTPUT);
+ pinMode(Yellow, OUTPUT);
+ pinMode(red, OUTPUT);
+}
+
+void loop() {
+
+ digitalWrite(Green, HIGH); // Turn on the green light
+ digitalWrite(Yellow, LOW); // Turn off the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(200); // Turn on the green light for 200 millisecond
+
+ digitalWrite(Green, LOW); // Turn on the green light
+ digitalWrite(Yellow, HIGH); // Put out the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(200); // Turn on the green light for 200 millisecond
+
+ digitalWrite(Green, LOW); // Turn off the green light
+ digitalWrite(Yellow, LOW); // Turn off the yellow light
+ digitalWrite(red, HIGH); // Turn on the red light
+ delay(200); // Turn on the green light for 200 millisecond
+
+}
diff --git a/ESP32S3-Tutorial/example/Lesson_6_Flow_light/README.md b/ESP32S3-Tutorial/example/Lesson_6_Flow_light/README.md
new file mode 100644
index 0000000..7b0d773
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_6_Flow_light/README.md
@@ -0,0 +1,63 @@
+# 6. Flowing water lamp
+
+## 6.1.Overview
+ In this section, you will learn how to use three LED lights to achieve a running water effect.
+
+## 6.2. Working principle
+ As in the previous section "Traffic Light Project", the LED on/off is controlled by controlling the high/low level of the three
+ LED light pins. After setting the waiting time for on and off, you can see the lighting process of the three LEDs one by one,
+ simulating the effect of running water lamps.
+
+## 6.3 Connection lines
+
+
+
+## 6.4 Upload code
+
+### 6.4.1 Connect the main control board to the computer using a USB cable
+
+
+
+### 6.4.2 Open the program file (path: 2_ESP32_S3_PLUS\ Lesson_6_Flow_light )
+
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board.
+
+## 6.5 Code analysis
+
+ Define three LED pins and operating modes
+
+```cpp
+#define Green 13 // Define the green light pin
+#define Yellow 11 // Define the yellow light pin
+#define red 10 // Define the red light pin
+
+void setup() {
+ // Define the pin as the output working mode
+ pinMode(Green, OUTPUT);
+ pinMode(Yellow, OUTPUT);
+ pinMode(red, OUTPUT);
+}
+```
+
+ Within the loop function, each LED light is lit individually at intervals of 200 milliseconds
+
+```cpp
+void loop() {
+
+ digitalWrite(Green, HIGH); // Turn on the green light
+ digitalWrite(Yellow, LOW); // Turn off the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(200); // Turn on the green light for 200 millisecond
+
+ digitalWrite(Green, LOW); // Turn on the green light
+ digitalWrite(Yellow, HIGH); // Put out the yellow light
+ digitalWrite(red, LOW); // Turn off the red light
+ delay(200); // Turn on the green light for 200 millisecond
+
+ digitalWrite(Green, LOW); // Turn off the green light
+ digitalWrite(Yellow, LOW); // Turn off the yellow light
+ digitalWrite(red, HIGH); // Turn on the red light
+ delay(200); // Turn on the green light for 200 millisecond
+}
+```
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_7_WS2812B/Lesson_7_WS2812B.ino b/ESP32S3-Tutorial/example/Lesson_7_WS2812B/Lesson_7_WS2812B.ino
new file mode 100644
index 0000000..34c9240
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_7_WS2812B/Lesson_7_WS2812B.ino
@@ -0,0 +1,22 @@
+#include
+
+ WS2812B is an intelligent externally controlled LED light source that integrates control circuit and light-emitting circuit. Its
+ appearance is the same as a 5050LED lamp bead, and each component is a pixel. There is an intelligent digital interface data
+ latch signal shaping amplification drive circuit, a high-precision internal oscillator and a 12V high-voltage programmable
+ fixed current control part inside the pixel, which effectively ensures that the pixel light color is highly consistent.
+ The data protocol adopts single-line zero return code communication method. After the pixel is powered on and reset, the
+ DIN client receives the data from the controller and first sends out the 24-bit data. After extracting the first pixel, it is sent to
+ the pixel data latch. The remaining data is shaped and amplified by the internal shaping processing circuit. . It starts to be
+
+ forwarded to the next cascade pixel through the DO output port. After each pixel is transmitted, the signal is reduced by 24
+ bits.The pixels adopt automatic shaping and forwarding technology, so that the number of cascades of pixels is not limited
+ by signal transmission, but only limited by the signal transmission speed requirements.
+
+## 7.3.Connect the lines
+
+
+
+## 7.4.Upload code
+
+### 7.4.1. Connect the main control board to the computer using a USB cable
+
+
+
+### 7.4.2 Open the program file (path: 2_ESP32_S3_PLUS\ Lesson_7_WS2812B )
+
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board.
+
+## 7.5. Code analysis
+
+Declare the FastLED library, define the ws2812 pin as 6, the number of lamp beads as 12 and the brightness value as 64.
+
+```cpp
+#include
+
+## 8.4. Upload code program
+
+### 8.4.1. Connect the main control board to the computer using a USB cable
+
+
+
+### 8.4.2 Open the program file (path: 2_ESP32_S3_PLUS\Lesson_8_Gradient_RGB_light)
+
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+
+ upload to be completed .
+
+## 8.5 Code analysis
+ The declaration library, pin definition and setting part of the code are consistent with the previous section, and then use the
+ fill_rainbow function in the loop function to implement the rainbow color gradient.
+
+```cpp
+void loop() {
+ // Gradients display different colors
+ for (int hue = 0; hue < 255; hue++) {
+ fill_rainbow(leds, NUM_LEDS, hue, 8);
+ FastLED.show();
+ delay(20);
+ }
+}
+```
\ No newline at end of file
diff --git a/ESP32S3-Tutorial/example/Lesson_9_Steering_gear_control/Lesson_9_Steering_gear_control.ino b/ESP32S3-Tutorial/example/Lesson_9_Steering_gear_control/Lesson_9_Steering_gear_control.ino
new file mode 100644
index 0000000..01b37fc
--- /dev/null
+++ b/ESP32S3-Tutorial/example/Lesson_9_Steering_gear_control/Lesson_9_Steering_gear_control.ino
@@ -0,0 +1,22 @@
+#include
+
+ The steering gear ( servo motor ) control pulse signal period is a 20MS pulse width modulation signal (PWM), the pulse
+ width is from 0.5ms to 2.5ms, and the corresponding steering position changes linearly from 0 to 180 degrees.
+ There is a reference circuit inside the steering gear, which generates a pulse signal with a period of 20ms and a width of
+ 1.5ms. There is a comparator that compares the external signal with the reference signal to determine the direction and size,
+ thereby generating a motor rotation signal.
+
+## 9.3 Connection lines
+
+
+
+## 9.4 Upload code program
+
+### 9.4.1 Connect the main control SD board to the computer using a USB cable
+
+
+
+### 9.4.2 Open the program file (path: 2_ESP32_S3_PLUS\Lesson_9_Steering_gear_control)
+ Also select the board type as ESP32S3 Dev Module and select the COM number newly displayed when the USB is plugged
+ in . Then click "Upload" to start compiling and uploading the program to the main control board, and wait for the program
+ upload to be completed .
+
+## 9.5 Code analysis
+
+ Declare the servo library Servo, define the servo pin A0 and instantiate the servo object myServo.
+
+```cpp
+#include