Skip to content

Commit

Permalink
Update Sketches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhentao-Lin committed Jul 2, 2024
1 parent 8716e2d commit 23f53d0
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
5 changes: 2 additions & 3 deletions C/Sketches/Sketch_03.1_BLE_USART/Sketch_03.1_BLE_USART.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++){
Expand Down
5 changes: 2 additions & 3 deletions C/Sketches/Sketch_06.2_WiFiServer/Sketch_06.2_WiFiServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 <WiFi.h>

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <WiFi.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
5 changes: 0 additions & 5 deletions C/Sketches/Sketch_07.1_CameraWebServer/partitions.csv

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <WiFi.h>
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 23f53d0

Please sign in to comment.