File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Introduction
2222 :target: https://github.com/psf/black
2323 :alt: Code Style: Black
2424
25- This library provides an asynchronous interface to the `` countio `` and `` keypad `` modules . It also provides
25+ This library provides an asynchronous way to wait for buttons to be pressed . It also provides
2626detection of single, double and triple clicks, and also long presses.
2727
2828
@@ -89,18 +89,30 @@ Or the following command to update an existing version:
8989
9090 circup update
9191
92- Usage Example
93- =============
92+ Usage
93+ =====
94+
95+ There are two classes:
96+
97+ * ``SimpleButton ``: This allows to ``await `` for presses and releases
98+
99+ .. code-block :: python
100+
101+ button = async_button.SimpleButton(board.D5, True )
102+ await button.pressed
94103
95- .. literalinclude :: ../examples/async_simplebutton_test.py
96- :caption: examples/async_simplebutton_test.py
97- :linenos:
104+ * `` Button ``: This has much more features. It creates a background process to monitor the button
105+ and allows the user to `` await `` for single clicks, double clicks, long clicks etc. It must be instantiated
106+ in an asynchronous environment
98107
99- .. literalinclude :: ../examples/async_button_test.py
100- :caption: examples/async_button_test.py
101- :linenos:
108+ .. code-block :: python
102109
110+ button = async_button.Button(board.D5, True )
111+ click = await button.wait_for_click()
112+ if click == button.DOUBLE :
113+ print (" Double click!" )
103114
115+ See the examples folder for full demonstrations
104116
105117Documentation
106118=============
You can’t perform that action at this time.
0 commit comments