diff --git a/C/Sketches/Sketch_03.1_BLE_USART/Sketch_03.1_BLE_USART.ino b/C/Sketches/Sketch_03.1_BLE_USART/Sketch_03.1_BLE_USART.ino index 37052ef..ac282cd 100644 --- a/C/Sketches/Sketch_03.1_BLE_USART/Sketch_03.1_BLE_USART.ino +++ b/C/Sketches/Sketch_03.1_BLE_USART/Sketch_03.1_BLE_USART.ino @@ -2,13 +2,12 @@ Filename : BLE_USART Description : Esp32 communicates with the phone by BLE and sends incoming data via a serial port Auther : www.freenove.com - Modification: 2022/10/26 + Modification: 2024/07/01 **********************************************************************/ #include "BLEDevice.h" #include "BLEServer.h" #include "BLEUtils.h" #include "BLE2902.h" -#include "String.h" BLECharacteristic *pCharacteristic; bool deviceConnected = false; @@ -31,7 +30,7 @@ class MyServerCallbacks: public BLEServerCallbacks { class MyCallbacks: public BLECharacteristicCallbacks { void onWrite(BLECharacteristic *pCharacteristic) { - std::string rxValue = pCharacteristic->getValue(); + String rxValue = pCharacteristic->getValue(); if (rxValue.length() > 0) { rxload=""; for (int i = 0; i < rxValue.length(); i++){ diff --git a/C/Sketches/Sketch_06.2_WiFiServer/Sketch_06.2_WiFiServer.ino b/C/Sketches/Sketch_06.2_WiFiServer/Sketch_06.2_WiFiServer.ino index 6f13dc9..203cbb5 100644 --- a/C/Sketches/Sketch_06.2_WiFiServer/Sketch_06.2_WiFiServer.ino +++ b/C/Sketches/Sketch_06.2_WiFiServer/Sketch_06.2_WiFiServer.ino @@ -3,7 +3,7 @@ Description : Use ESP32's WiFi server feature to wait for other WiFi devices to connect. And communicate with them once a connection has been established. Auther : www.freenove.com - Modification: 2022/10/31 + Modification: 2024/07/01 **********************************************************************/ #include @@ -30,12 +30,11 @@ void setup() Serial.println(WiFi.localIP()); Serial.printf("IP port: %d\n",port); server.begin(port); - WiFi.setAutoConnect(true); WiFi.setAutoReconnect(true); } void loop(){ - WiFiClient client = server.available(); // listen for incoming clients + WiFiClient client = server.accept(); // listen for incoming clients if (client) { // if you get a client, Serial.println("Client connected."); while (client.connected()) { // loop while the client's connected diff --git a/C/Sketches/Sketch_07.1_CameraWebServer/Sketch_07.1_CameraWebServer.ino b/C/Sketches/Sketch_07.1_CameraWebServer/Sketch_07.1_CameraWebServer.ino index 2272183..9c7dd48 100644 --- a/C/Sketches/Sketch_07.1_CameraWebServer/Sketch_07.1_CameraWebServer.ino +++ b/C/Sketches/Sketch_07.1_CameraWebServer/Sketch_07.1_CameraWebServer.ino @@ -2,7 +2,7 @@ Filename : Camera Web Server Description : The camera images captured by the ESP32S3 are displayed on the web page. Auther : www.freenove.com - Modification: 2022/10/31 + Modification: 2024/07/01 **********************************************************************/ #include "esp_camera.h" #include @@ -55,8 +55,8 @@ void setup() { config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; - config.pin_sscb_sda = SIOD_GPIO_NUM; - config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_sccb_sda = SIOD_GPIO_NUM; + config.pin_sccb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; @@ -99,6 +99,10 @@ void setup() { delay(500); Serial.print("."); } + while (WiFi.STA.hasIP() != true) { + Serial.print("."); + delay(500); + } Serial.println(""); Serial.println("WiFi connected"); diff --git a/C/Sketches/Sketch_07.1_CameraWebServer/partitions.csv b/C/Sketches/Sketch_07.1_CameraWebServer/partitions.csv deleted file mode 100644 index 4f76ca6..0000000 --- a/C/Sketches/Sketch_07.1_CameraWebServer/partitions.csv +++ /dev/null @@ -1,5 +0,0 @@ -# Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, 0x9000, 0x5000, -otadata, data, ota, 0xe000, 0x2000, -app0, app, ota_0, 0x10000, 0x3d0000, -fr, data, , 0x3e0000, 0x20000, diff --git a/C/Sketches/Sketch_07.2_As_VideoWebServer/Sketch_07.2_As_VideoWebServer.ino b/C/Sketches/Sketch_07.2_As_VideoWebServer/Sketch_07.2_As_VideoWebServer.ino index aca99cb..3a4962d 100644 --- a/C/Sketches/Sketch_07.2_As_VideoWebServer/Sketch_07.2_As_VideoWebServer.ino +++ b/C/Sketches/Sketch_07.2_As_VideoWebServer/Sketch_07.2_As_VideoWebServer.ino @@ -66,8 +66,8 @@ void cameraInit(void){ config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; - config.pin_sscb_sda = SIOD_GPIO_NUM; - config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_sccb_sda = SIOD_GPIO_NUM; + config.pin_sccb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; diff --git a/C/Sketches/Sketch_07.3_Camera_SDcard/Sketch_07.3_Camera_SDcard.ino b/C/Sketches/Sketch_07.3_Camera_SDcard/Sketch_07.3_Camera_SDcard.ino index a7a14a3..919e27f 100644 --- a/C/Sketches/Sketch_07.3_Camera_SDcard/Sketch_07.3_Camera_SDcard.ino +++ b/C/Sketches/Sketch_07.3_Camera_SDcard/Sketch_07.3_Camera_SDcard.ino @@ -72,8 +72,8 @@ int cameraSetup(void) { config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; - config.pin_sscb_sda = SIOD_GPIO_NUM; - config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_sccb_sda = SIOD_GPIO_NUM; + config.pin_sccb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; diff --git a/C/Sketches/Sketch_08.1_CameraTcpServer/Sketch_08.1_CameraTcpServer.ino b/C/Sketches/Sketch_08.1_CameraTcpServer/Sketch_08.1_CameraTcpServer.ino index 2e7e236..166cd62 100644 --- a/C/Sketches/Sketch_08.1_CameraTcpServer/Sketch_08.1_CameraTcpServer.ino +++ b/C/Sketches/Sketch_08.1_CameraTcpServer/Sketch_08.1_CameraTcpServer.ino @@ -2,7 +2,7 @@ Filename : Camera Tcp Serrver Description : Users use Freenove's APP to view images from ESP32S3's camera Auther : www.freenove.com - Modification: 2022/11/02 + Modification: 2024/07/01 **********************************************************************/ #include "esp_camera.h" #include @@ -39,10 +39,13 @@ void setup() { WiFi.begin(ssid_Router, password_Router); Serial.print("Connecting "); Serial.print(ssid_Router); - while (WiFi.isConnected() != true) { + while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); - //WiFi.begin(ssid_Router, password_Router); + } + while (WiFi.STA.hasIP() != true) { + Serial.print("."); + delay(500); } Serial.println(""); Serial.println("WiFi connected"); @@ -59,7 +62,7 @@ void setup() { } //task loop uses core 1. void loop() { - WiFiClient client = server_Camera.available(); // listen for incoming clients + WiFiClient client = server_Camera.accept(); // listen for incoming clients if (client) { // if you get a client, Serial.println("Camera Server connected to a client.");// print a message out the serial port String currentLine = ""; // make a String to hold incoming data from the client @@ -91,7 +94,7 @@ void loop() { void loopTask_Cmd(void *pvParameters) { Serial.println("Task Cmd_Server is starting ... "); while (1) { - WiFiClient client = server_Cmd.available(); // listen for incoming clients + WiFiClient client = server_Cmd.accept(); // listen for incoming clients if (client) { // if you get a client, Serial.println("Command Server connected to a client.");// print a message out the serial port String currentLine = ""; // make a String to hold incoming data from the client @@ -138,8 +141,8 @@ void cameraSetup() { config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; - config.pin_sscb_sda = SIOD_GPIO_NUM; - config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_sccb_sda = SIOD_GPIO_NUM; + config.pin_sccb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000;