ADS1115 Analog Sticks with uinput
-
Hey guys, I have 2 analog sticks connected to a ads1115 which is connected to my rpi3. I got them working properly, did some adafruit example scripts and they seem to work just fine. But I cannot figure out what to do in order to get them working on retropie using uinput. I have my ads1115 connected to I2C1 (physical pins 3 and 5). Thanks in advance!
-
Are you emulating a full gamepad via
uinput
or just the sticks ? In order to be able to configure them in EmulationStation, you'll need a full gamepad.
If they show up only as sticks, then you may be able to configure them in individual emulators (advmame
,mame
, etc.) - but you can do so from within the emulator itself, using the emulator's configuration menu. -
@mitu Hello, Sorry for the late answer I have not been home this day. I am trying to actually understand how to emulate a full gamepad, I have buttons and these analog sticks that I wanna make recognizable as a gamepad. I have no idea how to actually make them recognizable, though. I used GPIOnext in order to make my buttons recognizable as a actual gamepad, but the analog sticks I cannot figure out how to make usable. (cliche but excuse me for my english, currently pretty late.. I am serious about this and not just some random idiot not knowing what he's doing, I can follow any instructions I am given so yeah, please help if possible and thank you in advance :).)
-
My guess is that you need an single
uinput
script that processes the inputs from both the buttons and analog sticks and combines them into a single gamepad. GPIOnext translates GPIO inputs to keystrokes, so it doesn't handle the ads1115 analog inputs.
You can find something similar here. -
@mitu thank you! I'll take a look later, I'm also certain changing up the script is possible so I can add another analog stick input
-
@obmai89 Do you think it is possible to use the pins 3 and 5 (I2C1) instead of having to reconnect them to the 2 middle pins? Is there any difference between I2C1 and I2C?
-
@obmai89 said in ADS1115 Analog Sticks with uinput:
Do you think it is possible to use the pins 3 and 5 (I2C1) instead of having to reconnect them to the 2 middle pins?
No idea to be honest.
-
@mitu Alright, I'll just connect it to the middle i2c pins. Dude thank you so so so much for actually answering my post, this is what I was looking for and this is basically the last step to finishing my project. THANK YOU!
-
@mitu Hey again, I followed all instructions and ran the script. When running it I get the error: ModuleNotFoundError: No module named 'uinput'
This shouldn't happen, as I did pip3 install python-uinput just like the github page said.
-
@obmai89 said in ADS1115 Analog Sticks with uinput:
When running it I get the error: ModuleNotFoundError: No module named 'uinput'
Are you running the script with
python3 <scriptname>
? -
I ran it on python3 i got the uinput error, then i ran it on python. The uinput error is now gone but I get this:
Traceback (most recent call last):
File "gpio_js_driver_super_game_pi.py", line 21, in <module>
adc = ADS1x15(i2c=ADS1115)
TypeError: 'module' object is not callable -
This post is deleted! -
@mitu Ah sorry mate, I am new to this forum and I keep on sending messages before finishing them up, hence the reason for the edit and the deleted message... I wanted to say now I got another module missing error on python3, I will fix it first then Ill come back if I hit a roadblock...
-
@mitu Here I am again, after managing to remove all module not found errors (for now) I get this new one:
Traceback (most recent call last):
File "gpio_js_driver_super_game_pi.py", line 21, in <module>
adc = ADS1x15(ic=ADS1115)
TypeError: 'module' object is not callablethis is what I get after doing sudo python3 <script>.
edit: Apologies for the messy convo so far, as I said I am new to this forums and still getting the hang of it :). Hope I didn't give a bad impression.
-
@obmai89 Not sure where the error comes from - but didn't you already have code that was working already ? Replace the analog sticks handling in the sample script I linked with your code and re-use just the button part for emitting gamepad button events.
-
@mitu Hey, I managed to fix it. I do get another issue now though,
AttributeError: 'ADS1115' object has no attribute 'readADCSingleEnded'Got any ideas how to fix it?
-
Sorry, no idea.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.