LED can change Blink frequency by changing delay time
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
Serial.println("blink on");
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Flash every second
Phone pairing to connect to Bluetooth
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
Serial.println("My name is ESP32test");
}
ESP32 Bluetooth name is set by SerialBT.begin()
Wifi scan serial port information display can connect wifi name and signal strength
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done")
By connecting to WiFi, you can generate a web page.
const char* ssid = "TP-LINK-";//Please input your wifi ID
const char* password = "123456";//Please input your wifi password
//Log in with a browser to generate a mac address:
//example:192.168.0.108
digitalWrite(led, 1);
server.send(200, "text/plain", "hello from esp32!");
digitalWrite(led, 0);
Log in to 192.168.0.x,The screen will display:"hello from esp32!"
Read the name of the SD card storage information according to the serial port information.
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.print("Initializing SD card...");
/* initialize SD library with SPI pins */
if (!SD.begin(13,15,2,14)) { //T1:13,15,2,14 T2: 23,5,19,18 M5:4,23,19,18 uint8_t csPin, int8_t mosi, int8_t miso, int8_t sck
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
Please note that the baud rate is consistent
Lora_send send data Lora_receive