Skip to content

Commit 8336ceb

Browse files
committed
examplz
1 parent b179fc8 commit 8336ceb

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,27 @@ To install in a virtual environment in your current project:
6060
Usage Example
6161
=============
6262

63-
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
63+
.. code-block:: python
64+
65+
import board
66+
import digitalio
67+
import adafruit_aw9523
68+
69+
i2c = board.I2C()
70+
aw = adafruit_aw9523.AW9523(i2c)
71+
72+
led_pin = aw.get_pin(0) # LED on AW9523 io 0
73+
button_pin = aw.get_pin(1) # Button on AW io 1
74+
75+
# LED is an output, initialize to high
76+
led_pin.switch_to_output(value=True)
77+
# Button is an input, note internal pull-ups are not supported!
78+
button_pin.direction = digitalio.Direction.INPUT
79+
80+
while True:
81+
# LED mirrors button pin
82+
led_pin.value = button_pin.value
83+
6484
6585
Contributing
6686
============

0 commit comments

Comments
 (0)