יש רשימה של פקודות מסדרות לניתוק ? אני מנסה להבין איפה הבעיה שלי
#include <BluetoothSerial.h>
BluetoothSerial ESP_BT;
void setup() {
Serial.begin(115200); // Initialize serial communication for debugging
ESP_BT.begin("MyESP32Device"); // Set the device name
// Set a random PIN for authentication
ESP_BT.setPin("1234"); // Change the PIN to a desired value
// Start scanning for nearby devices
ESP_BT.inquire();
}
void loop() {
// Check if any device is available
if (ESP_BT.available()) {
// Get the address of the remote device
uint8_t remoteAddress[6];
ESP_BT.remoteAddress(remoteAddress);
// Print the address for debugging
Serial.print("Found device with address: ");
for (int i = 0; i < 6; i++) {
Serial.print(remoteAddress[i], HEX);
if (i < 5) {
Serial.print(":");
}
}
Serial.println();
// Disconnect from the device
ESP_BT.disconnect();
// Delay before scanning again
delay(5000);
// Scan for devices again
ESP_BT.inquire();
}
}