You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello guys, I'm new here. I wanted to tell you about a problem that is giving me a headache.
It mainly focuses on linking with any Android device.
The device appears visible but when it comes to linking, an error appears that does not allow connection.
I am specifically using an esp32 S3 Zero with the latest Blekeyboard library 0.3.2
Let's see if the same thing happens to anyone or has a solution because I'm stuck.
I have also changed lines 106 and 117 of the library with [.c_str()] Issue nº 347
This is the code I´m using:
#include <Arduino.h>
#include <BleKeyboard.h>
BleKeyboard bleKeyboard("ESP32_Keyboard", "ESP32_Dev", 100);
const int buttonPin = 9; // Cambia al GPIO de tu botón
void restartBLE() {
Serial.println("Reiniciando BLE para asegurar reconexión...");
bleKeyboard.end();
delay(500);
bleKeyboard.begin();
}
void setup() {
Serial.begin(115200);
pinMode(buttonPin, INPUT_PULLUP);
Serial.println("Iniciando BLE Keyboard...");
bleKeyboard.begin();
unsigned long startTime = millis();
while (!bleKeyboard.isConnected() && millis() - startTime < 5000) {
Serial.println("Esperando conexión BLE...");
delay(500);
}
if (bleKeyboard.isConnected()) {
Serial.println("BLE Conectado!");
delay(1000);
bleKeyboard.write(KEY_MEDIA_VOLUME_UP);
Serial.println("Primer comando enviado para activar HID.");
} else {
Serial.println("BLE no conectado, intentando reiniciar...");
restartBLE();
}
}
void loop() {
if (digitalRead(buttonPin) == LOW) {
Serial.println("Botón presionado, enviando volumen arriba...");
if (bleKeyboard.isConnected()) {
bleKeyboard.write(KEY_MEDIA_VOLUME_UP);
} else {
Serial.println("BLE desconectado, intentando reiniciar...");
restartBLE();
}
delay(300);
}
}
The text was updated successfully, but these errors were encountered:
Investigating I have found what the problem seems to be. It turns out that it gave errors when pairing using the link security codes.
What I have done is basically override it from the code.
I would like to preserve that security but in the meantime it is functional. I hope it helps you and a solution is found soon.
Hello guys, I'm new here. I wanted to tell you about a problem that is giving me a headache.
It mainly focuses on linking with any Android device.
The device appears visible but when it comes to linking, an error appears that does not allow connection.
I am specifically using an esp32 S3 Zero with the latest Blekeyboard library 0.3.2
Let's see if the same thing happens to anyone or has a solution because I'm stuck.
I have also changed lines 106 and 117 of the library with [.c_str()] Issue nº 347
This is the code I´m using:
The text was updated successfully, but these errors were encountered: