We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd91c13 commit 5307005Copy full SHA for 5307005
examples/i2c-pcf8574.py
@@ -0,0 +1,16 @@
1
+"""
2
+An example of a script that can be used with the run-script mode.
3
+
4
+This will read and write the pins of a PCF8574. Once connected, run:
5
6
+ glasgow run-script i2c-pcf8574.py i2c-initiator -V 3.3
7
8
9
+# read pin values
10
+print('I/O pin state: 0b{:08b}'.format((await iface.read(0x20, 1))[0]))
11
12
+# write pin values
13
+await iface.write(0x20, [ 0x55 ])
14
15
+# power down the device after use
16
+await device.set_voltage("AB", 0)
0 commit comments