{"id":26642686,"url":"https://github.com/frc4564/xbox","last_synced_at":"2025-08-02T23:07:21.203Z","repository":{"id":48745409,"uuid":"14436509","full_name":"FRC4564/Xbox","owner":"FRC4564","description":"Python class to support xbox 360 controller under Linux on RaspberryPi","archived":false,"fork":false,"pushed_at":"2019-06-28T07:25:40.000Z","size":18,"stargazers_count":131,"open_issues_count":4,"forks_count":35,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-20T12:46:46.082Z","etag":null,"topics":["controller","python","raspberry-pi","xbox"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FRC4564.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-15T22:15:40.000Z","updated_at":"2024-12-22T20:17:25.000Z","dependencies_parsed_at":"2022-09-23T20:52:20.393Z","dependency_job_id":null,"html_url":"https://github.com/FRC4564/Xbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRC4564%2FXbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRC4564%2FXbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRC4564%2FXbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRC4564%2FXbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FRC4564","download_url":"https://codeload.github.com/FRC4564/Xbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312127,"owners_count":21082635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["controller","python","raspberry-pi","xbox"],"created_at":"2025-03-24T19:21:27.585Z","updated_at":"2025-04-10T22:38:59.355Z","avatar_url":"https://github.com/FRC4564.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"xbox.py\n=======\n\nPython class to support reading xbox 360 wired and wireless controller input under Linux.  Makes it easy to get real-time input from controller buttons, analog sticks and triggers.  Built and tested on RaspberryPi running Raspbian.\n\nRequires that xboxdrv be installed first:\n\n    sudo apt-get install xboxdrv\n\nTo test the driver, issue the following command and see if the controller inputs are recognized\n\n    sudo xboxdrv --detach-kernel-driver\n\nSee http://pingus.seul.org/~grumbel/xboxdrv/ for details on xboxdrv\n\nDownload the python module and sample code with the following:\n\n    wget https://raw.githubusercontent.com/FRC4564/Xbox/master/xbox.py\n    wget https://raw.githubusercontent.com/FRC4564/Xbox/master/sample.py\n\nYou can run the sample code to see how the Joystick class works.\n\n    sudo python sample.py\n\nExample class usage:\n\n    import xbox\n    joy = xbox.Joystick()         #Initialize joystick\n    \n    if joy.A():                   #Test state of the A button (1=pressed, 0=not pressed)\n        print 'A button pressed'\n    x_axis   = joy.leftX()        #X-axis of the left stick (values -1.0 to 1.0)\n    (x,y)    = joy.leftStick()    #Returns tuple containing left X and Y axes (values -1.0 to 1.0)\n    trigger  = joy.rightTrigger() #Right trigger position (values 0 to 1.0)\n    \n    joy.close()                   #Cleanup before exit\n\nNote:\nRun your code with sudo privileges to allow xboxdrv the necessary control over USB devices.\nIf you want, you can provide your user account with the proper access, so you needn't use sudo.\n\nFirst, add your user to the root group. Here's how to do this for the user ‘pi’\n\n    sudo usermod -a -G root pi\n\nCreate a permissions file using the nano text editor.\n\n    sudo nano /etc/udev/rules.d/55-permissions-uinput.rules\n\nEnter the following rule and save your entry.\n\n    KERNEL==\"uinput\", MODE=\"0660\", GROUP=\"root\"\n\nTroubleshooting\n---------------\n\nI find that xboxdrv occasionally has trouble connecting to the controller.  You may see a USB device error or something similar.  Issuing the following command will detach and reconnect the controller.\n\n    sudo xboxdrv --detach-kernel-driver\n    \nYou should now be able to move the joysticks and press buttons to see the controller state display for all inputs.  Just press Ctrl-C to exit and then relaunch your python code that uses xbox.py.\n\nIf your wireless controller still won't connect, press the sync button on the controller and the receiver (both devices need to be powered).\n\nUsage\n-----\n\nA good application for an XBox controller is for robot control.  Check out [Basic PiBot](https://github.com/FRC4564/BasicPiBot) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrc4564%2Fxbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrc4564%2Fxbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrc4564%2Fxbox/lists"}