Skip to content

Commit 194949c

Browse files
committed
pybricks.iodevices.XboxController: Document pairing.
1 parent d3ca8ee commit 194949c

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

doc/main/iodevices/xboxcontroller.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,59 @@ Xbox Controller
5454

5555
.. automethod:: pybricks.iodevices::XboxController.profile
5656

57+
.. _xbox-controller-pairing:
5758

59+
Xbox Controller Pairing Instructions
60+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61+
The first time you use a controller with a hub, you will need to pair
62+
them: Turn the controller on and then press and hold the pairing
63+
button on the back of the controller for a few seconds. When you release
64+
it, the Xbox button starts flashing more rapidly. Then start your program.
65+
66+
When pairing and the connection is succesful, the Xbox button will stop
67+
flashing and stay on for as long as the program is running.
68+
69+
Repeat Connections
70+
==================
71+
72+
If you keep using the same controller with the same hub, you can simply
73+
turn the controller on the next time and the hub will connect to it
74+
automatically when your program with this class runs.
75+
76+
The Xbox controller only accepts this simpler connection with the most
77+
recently connected device. So if you connect to your Xbox console again, or
78+
connect to another hub, you will need to pair them again as described
79+
above.
80+
81+
Compatible Controllers
82+
============================
83+
84+
All Xbox controllers released since 2016 are compatible. This includes the
85+
controller from the One S (``1708`` from 2016), the Elite Series 2 (``1797``
86+
from 2019), and the Series X/S (``1914`` from 2020), which is
87+
the latest model as of this writing.
88+
89+
.. raw:: html
90+
91+
<p>See also <a href="https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Summary" target="_blank">
92+
this overview</a> of model numbers including pictures of each controller.</p>
93+
94+
Updating the Xbox Controller
95+
============================
96+
97+
If you frequently use the Xbox Controller with your console, your controller
98+
is probably already up to date. If you have not used it for a while or if you
99+
bought one recently, you may need to update it.
100+
101+
To update the controller without a console, you can use the Xbox Accessories
102+
app on a Windows computer. You can download it from the Microsoft Store.
103+
Connect the controller via USB to the computer and follow the instructions in
104+
the app to click on "Update now".
105+
106+
Technic Hub Limitations
107+
=======================
108+
109+
Due to limitations of the Technic Hub, the hub will disconnect from the
110+
computer when searching for the Xbox controller. This means you will not be
111+
able to see output from the ``print`` command. Also, you'll have to connect to
112+
the computer again if you want to change your program.

src/pybricks/iodevices.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,14 @@ def read(self) -> bytes:
337337

338338

339339
class XboxController:
340-
"""Microsoft® Xbox® controller."""
340+
"""Use the Microsoft® Xbox® controller as a sensor in your projects to
341+
control them remotely.
342+
343+
The hub will scan for the controller and connect to it. It will disconnect
344+
when the program ends.
345+
346+
For tips on connectivity and pairing, see :ref:`below <xbox-controller-pairing>`.
347+
"""
341348

342349
buttons = _common.Keypad([])
343350

0 commit comments

Comments
 (0)