ESP32-BLE-Keyboard icon indicating copy to clipboard operation
ESP32-BLE-Keyboard copied to clipboard

Cant pair to ESP32

Open kkuez opened this issue 4 years ago • 8 comments

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

  • Example sketch
  • PlatformIO/ Arduino IDE does not matter
  • ESP gets detected
  • Trying to pair
  • Android phones state "Couldnt pair due to incorrect key/password entry"
  • ESP starts working as if device is connected (Enters Keys af)

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: <DeviceName> Alias: <DeviceName> Appearance: 0x03c1 Icon: input-keyboard Paired: no Trusted: no Blocked: no Connected: no LegacyPairing: no UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)

kkuez avatar Feb 06 '21 11:02 kkuez

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.

T-vK avatar Feb 06 '21 12:02 T-vK

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

kkuez avatar Feb 06 '21 15:02 kkuez

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.

T-vK avatar Feb 06 '21 16:02 T-vK

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

Fusseldieb avatar May 05 '21 12:05 Fusseldieb

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 avatar Nov 17 '21 17:11 bauerbyter

Version 0.3.0. is now working!

bauerbyter avatar Nov 18 '21 13:11 bauerbyter

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!!

Fusseldieb avatar Nov 18 '21 19:11 Fusseldieb

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

bauerbyter avatar Nov 19 '21 05:11 bauerbyter