Multiple issues: pins not working, not always connecting, sometimes high latency

ersatz
Posts: 4
Joined: Sat Feb 20, 2021 2:19 am

Multiple issues: pins not working, not always connecting, sometimes high latency

Postby ersatz » Sun Feb 28, 2021 10:23 pm

Hi folks, I'm trying to make a custom game controller with an esp32 based on the ESP32-BLE-Gamepad library, but I'm running into a few problems:

I'm able to `analogRead` the six pins I need for the controller axes, but it seems that I can only get `digitalRead` to work on pins 27 and 14. I've tried a bunch of other pins and have referred to this very useful guide to what different pins do, but I can't seem to get other pins to read.

My esp32 connects *very slowly*. After after a power cycle, it will often sit there for 30-60 seconds (or more!) without connecting. Often I give up when it's gone for 20s and reset it, and it sometimes (though very rarely) connects in as few as 4-5 seconds. It's my understanding that BLE should connect very quickly when paired, and I'd think this would apply after a power cycle. But even if ~4 seconds is a good as I can expect, that would a heck of lot better than an inconsistent connection that ranges from between 20-80seconds.

The latency between inputs and response on the computer also seems to be rather inconsistent. I'm early in my explorations for this simple proof-of-concept test build, so I haven't built a fancy latency testing setup, but just from looking at the Game Controllers properties pane in Windows, I have observed some occasions on which the there seems to be virtually no visible latency, to occasions on which the latency is probably on the order of 500-1000 milliseconds. On average it seems to be perhaps a couple hundred ms, which is still too slow to be useful, but I'm kind of more puzzled by the inconsistency. (However: I'd also love tips about how to reduce this latency.)

My complete code (using Arduino) is available in this GitHub gist, and I'll be happy to answer any questions about my setup. Many thanks for any ideas!

Who is online

Users browsing this forum: No registered users and 41 guests