T-vK / ESP32-BLE-Keyboard

Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
2.38k stars 398 forks source link

Cant pair to ESP32 #71

Open kkuez opened 3 years ago

kkuez commented 3 years ago

Unfortunately I cannot provide any stacktrace or similiar. I remember it working fine half a year ago.

I changed psecurity Authmode to ESP_LE_AUTH_NO_BOND in BleKeyboard.cpp and rebuild -> Nothing changed

Tried with 0.2.2 as well as 0.2.1

bluetoothctl info:

Device XX:XX:XX:XX:XX:XX (public) Name: Alias: Appearance: 0x03c1 Icon: input-keyboard Paired: no Trusted: no Blocked: no Connected: no LegacyPairing: no UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)

T-vK commented 3 years ago

Try disconnecting, unpairing and removing the ESP form your Android device, turn Bluetooth off (on your phone), wait a few seconds, then turn it on again and try to pair and connect again.

kkuez commented 3 years ago

It helped. Thanks! Is this a known issue which might be solved in the future? Regards

T-vK commented 3 years ago

Yes, it's a known issue and I hope we can fix it in the future. It's quite possible that one of the open Pull Requests already fixes this issue, but it's a complicated situation as some of the Pull Requests break compatibility with some Apple devices.

Fusseldieb commented 3 years ago

Just tried out this library!

They keypresses work wonderfully, but it almost never wants to connect. I need to re-pair it everytime and most of the time it just refuses to connect...

Often it spams the message

[E][BLECharacteristic.cpp:528] notify(): << esp_ble_gatts_send_ notify: rc=-1 Unknown ESP_ERR error

in the log

bauerbyter commented 2 years ago

Have the same problem. Does someone have a solution? Edit: To be more specific. Same behavior on 3 Devices. You can pair but it is not connected, when you "tap" connect, it is trying a while and than nothing happens.

#include <BleKeyboard.h>

#define RIGHT_TURN 4
#define LEFT_TURN 5

BleKeyboard bleKeyboard("Device", "FooBar", 100);
void setup() {
  bleKeyboard.begin();

  pinMode(LEFT_TURN, INPUT_PULLUP);
  pinMode(RIGHT_TURN, INPUT_PULLUP);
}

void loop() {
  if (bleKeyboard.isConnected() && !digitalRead(RIGHT_TURN)) {
    bleKeyboard.press(KEY_RIGHT_ARROW);
    delay (250);
    bleKeyboard.releaseAll();
    while(!digitalRead(RIGHT_TURN)){
      delay(1);}
  }
  if (bleKeyboard.isConnected() && !digitalRead(LEFT_TURN)) {
    bleKeyboard.press(KEY_LEFT_ARROW);
    delay (250);

    bleKeyboard.releaseAll();
    while(!digitalRead(LEFT_TURN)){
      delay(1);}
  }

} 
bauerbyter commented 2 years ago

Version 0.3.0. is now working!

Fusseldieb commented 2 years ago

Version 0.3.0. is now working!

Has the owner updated the repo since then? If yes, I will absolutely give it another try :D

EDIT: He sure has. It's pretty active, that's awesome! I will give it another try!!

bauerbyter commented 2 years ago

In my case the latest beta didnt work. But 0.3.0 did.