Hamster guy
Hamster guy

Reputation: 11

Lego NXT joystick for PC

I am trying to build a Lego NXT joystick to connect to my computer to play war thunder with. I am planning to use NXT-Python, but I can't get anything to work. I'm using this code:

#!/usr/bin/python3
"""NXT-Python tutorial: find the brick."""
import nxt.locator

# Find a brick.
with nxt.locator.find() as b:
    # Once found, print its name.
    print("Found brick:", b.get_device_info()[0])
    # And play a recognizable note.
    b.play_tone(440, 250)

This was a test just to make sure that python can connect to the brick. No matter what I do, I'm getting this error:

Traceback (most recent call last):
  File "C:\Users\someone\Downloads\test.py", line 6, in <module>
    with nxt.locator.find() as b:
  File "C:\Users\someone\AppData\Local\Programs\Python\Python313\Lib\site-packages\nxt\locator.py", line 239, in find
    brick = next(iter_bricks(), None)
  File "C:\Users\someone\AppData\Local\Programs\Python\Python313\Lib\site-packages\nxt\locator.py", line 217, in iter_bricks
    for brick in backend.find(name=name, host=host, **filters):
  File "C:\Users\someone\AppData\Local\Programs\Python\Python313\Lib\site-packages\nxt\backend\usb.py", line 103, in find
    for dev in usb.core.find(
  File "C:\Users\someone\AppData\Local\Programs\Python\Python313\Lib\site-packages\usb\core.py", line 1321, in find
    raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available

I can't figure out what I'm doing wrong!

OK so I've been messing around and I'm gonna have to do a little bit more experimenting but I downloaded libusb-win32, grabbed it's DLL, and put it in the same folder as the python.exe, and I THINK it works now. I'll have to do a bit more testing though.

Upvotes: -3

Views: 56

Answers (1)

Hamster guy
Hamster guy

Reputation: 11

So I figured it out; I just needed that dll file. I downloaded libusb-win32, extracted it, found it's DLL file, and put it in the same folder as my python.exe. It's not giving me the backend error anymore. (Now it's not able to find the brick, but I'll figure it out myself.)

Upvotes: 1

Related Questions