Update Sketches.

This commit is contained in:
Zhentao-Lin 2024-07-01 14:50:50 +08:00
parent a564cc2a01
commit 12d9729838
11 changed files with 24 additions and 24 deletions

View File

@ -2,7 +2,7 @@
* Filename : Blink
* Description : Make an led blinking.
* Auther : www.freenove.com
* Modification: 2020/07/11
* Modification: 2024/06/18
**********************************************************************/
#define LED_BUILTIN 2
// the setup function runs once when you press reset or power the board
@ -13,8 +13,8 @@ void setup() {
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW); // turn the LED on by making the voltage LOW
delay(1000); // wait for a second
}

View File

@ -2,7 +2,7 @@
Filename : SerialToSerialBT
Description : ESP32 communicates with the phone by bluetooth and print phone's data via a serial port
Auther : www.freenove.com
Modification: 2020/07/11
Modification: 2024/06/19
**********************************************************************/
#include "BluetoothSerial.h"
@ -12,6 +12,7 @@ void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("\nThe device started, now you can pair it with bluetooth!");
Serial.println("Hello!");
}
void loop() {

View File

@ -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: 2020/07/11
Modification: 2024/06/19
**********************************************************************/
#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++){
@ -57,7 +56,7 @@ void setupBLE(String BLEName){
}
void setup() {
Serial.begin(9600);
Serial.begin(115200);
setupBLE("ESP32_Bluetooth");
}

View File

@ -2,7 +2,7 @@
Filename : SDMMC Test
Description : The SD card is accessed using the SDMMC one-bit bus
Auther : www.freenove.com
Modification: 2023/08/21
Modification: 2024/06/20
**********************************************************************/
#include "sd_read_write.h"
#include "SD_MMC.h"

View File

@ -2,7 +2,7 @@
Filename : WiFi Station
Description : Connect to your router using ESP32
Auther : www.freenove.com
Modification: 2020/07/11
Modification: 2024/06/20
**********************************************************************/
#include <WiFi.h>

View File

@ -2,7 +2,7 @@
Filename : WiFi AP
Description : Set ESP32 to open an access point
Auther : www.freenove.com
Modification: 2020/07/11
Modification: 2024/06/20
**********************************************************************/
#include <WiFi.h>

View File

@ -2,7 +2,7 @@
Filename : WiFi AP+Station
Description : ESP32 connects to the user's router, turning on an access point
Auther : www.freenove.com
Modification: 2020/07/11
Modification: 2024/06/20
**********************************************************************/
#include <WiFi.h>

View File

@ -2,7 +2,7 @@
Filename : WiFi Client
Description : Use ESP32's WiFi client feature to connect and communicate with a remote IP.
Auther : www.freenove.com
Modification: 2020/07/11
Modification: 2024/06/20
**********************************************************************/
#include <WiFi.h>

View File

@ -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: 2020/07/11
Modification: 2024/06/20
**********************************************************************/
#include <WiFi.h>
@ -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

View File

@ -3,7 +3,7 @@
Description : ESP32 connects to WiFi and prints a url through a serial port.
Users visit the site to view the image data ESP32 camera.
Auther : www.freenove.com
Modification: 2021/12/01
Modification: 2024/06/20
**********************************************************************/
#include "esp_camera.h"
#include <WiFi.h>
@ -57,7 +57,8 @@ void setup() {
s->set_saturation(s, -1); //lower the saturation
WiFi.begin(ssid_Router, password_Router);
while (WiFi.isConnected() != true) {
WiFi.setSleep(false);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
@ -90,8 +91,8 @@ void config_init() {
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;
@ -100,6 +101,6 @@ void config_init() {
//config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 12;
config.fb_count = 1;
config.jpeg_quality = 10;
config.fb_count = 2;
}

View File

@ -36,8 +36,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;