Skip to content

Commit 65fb213

Browse files
authored
Merge pull request #51 from larsks/bug/usb_hid
update README to match changes in ea9b71d
2 parents 83d6726 + 174255b commit 65fb213

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

README.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ The ``Keycode`` class defines USB HID keycodes to send using ``Keyboard``.
3636

3737
.. code-block:: python
3838
39+
import usb_hid
3940
from adafruit_hid.keyboard import Keyboard
4041
from adafruit_hid.keycode import Keycode
4142
4243
# Set up a keyboard device.
43-
kbd = Keyboard()
44+
kbd = Keyboard(usb_hid.devices)
4445
4546
# Type lowercase 'a'. Presses the 'a' key and releases it.
4647
kbd.send(Keycode.A)
@@ -78,10 +79,11 @@ by various operating systems.
7879

7980
.. code-block:: python
8081
82+
import usb_hid
8183
from adafruit_hid.keyboard import Keyboard
8284
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
8385
84-
kbd = Keyboard()
86+
kbd = Keyboard(usb_hid.devices)
8587
layout = KeyboardLayoutUS(kbd)
8688
8789
# Type 'abc' followed by Enter (a newline).
@@ -95,9 +97,10 @@ The ``Mouse`` class simulates a three-button mouse with a scroll wheel.
9597

9698
.. code-block:: python
9799
100+
import usb_hid
98101
from adafruit_hid.mouse import Mouse
99102
100-
m = Mouse()
103+
m = Mouse(usb_hid.devices)
101104
102105
# Click the left mouse button.
103106
m.click(Mouse.LEFT_BUTTON)
@@ -125,10 +128,11 @@ remote controls, or the multimedia keys on certain keyboards.
125128

126129
.. code-block:: python
127130
131+
import usb_hid
128132
from adafruit_hid.consumer_control import ConsumerControl
129133
from adafruit_hid.consumer_control_code import ConsumerControlCode
130134
131-
cc = ConsumerControl()
135+
cc = ConsumerControl(usb_hid.devices)
132136
133137
# Raise volume.
134138
cc.send(ConsumerControlCode.VOLUME_INCREMENT)
@@ -142,9 +146,10 @@ The ``Gamepad`` class emulates a two-joystick gamepad with 16 buttons.
142146

143147
.. code-block:: python
144148
149+
import usb_hid
145150
from adafruit_hid.gamepad import Gamepad
146151
147-
gp = Gamepad()
152+
gp = Gamepad(usb_hid.devices)
148153
149154
# Click gamepad buttons.
150155
gp.click_buttons(1, 7)

0 commit comments

Comments
 (0)