Closed luissperber closed 11 months ago
Finally can solve this:
PS: To activate NimBLE mode: Go to the ESP32-BLE-Keyboard library folder, open BleKeyboard.h, and uncomment the 2nd line: "#define USE_NIMBLE"."
Now Android devices connect almost instantly and reconnect well and fast.
Hi there. I've been having problems with the ESP32 and an Android TV. Firstly, the pairing is slow and sometimes fails (the ESP32 is not discovered). I am completely unable to reconnect unless I remove the ESP from my Android and pair it again.
I've only been trying to send a keypress, so I don't think it's a code problem. I've tried versions 0.2.3, 0.3.0, and 0.3.2 beta, and none of them have worked.
include
const int buttonPin1 = 16; boolean oldPinState1 = LOW;
void setup() { pinMode(buttonPin1, INPUT_PULLDOWN); bleKeyboard.begin(); }
void loop() { if(bleKeyboard.isConnected()) { if (digitalRead(buttonPin1) == HIGH) { if (oldPinState1 == LOW) { bleKeyboard.write(KEY_UP_ARROW); delay (100); bleKeyboard.releaseAll(); } oldPinState1 = HIGH; } else { oldPinState1 = LOW; } delay(10); } }
The interesting thing is that it works on Windows 11. I can pair, shut down, and connect; everything works perfectly.
Do you have any solutions or suggestions? Thanks