Загружается Arduino IDE2.1.1 скетч:
/*Program to control LED (ON/OFF) from ESP32 using Serial Bluetooth
* Thanks to Neil Kolbans for his efoorts in adding the support to Arduino IDE
* Turotial on: www.circuitdigest.com
*/
#include "BluetoothSerial.h" //Header File for Serial Bluetooth, will be added by default into Arduino
BluetoothSerial ESP_BT; //Object for Bluetooth
int incoming;
int LED_BUILTIN = 2;
void setup() {
Serial.begin(9600); //инициализируем последовательную связь со скоростью 9600 бод
ESP_BT.begin("ESP32_LED_Control"); //Name of your Bluetooth Signal (имя нашего Bluetooth соединения)
Serial.println(" ");
Serial.println("Bluetooth Device is Ready to Pair");
pinMode (LED_BUILTIN, OUTPUT);//Specify that LED pin is output (режим работы контакта на вывод данных)
}
void loop() {
if (ESP_BT.available()) //проверяем получаем ли мы что-нибудь по Bluetooth
{
incoming = ESP_BT.read(); //считываем то, что мы принимаем
Serial.print("Received:"); Serial.println(incoming);
if (incoming == 49)
{
digitalWrite(LED_BUILTIN, HIGH);
ESP_BT.println("LED turned ON");
}
if (incoming == 48)
{
digitalWrite(LED_BUILTIN, LOW);
ESP_BT.println("LED turned OFF");
}
}
delay(20);
}
ни iPhonSE ни iPhon7 объявленный ESP32_LED_Control не видят, хотя себя и часы в списках сетей блютус наблюдаются.