We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0633e4c commit 6665cd5Copy full SHA for 6665cd5
py/examples/ezbang_1hz.py
@@ -0,0 +1,27 @@
1
+"""
2
+ezbang API example
3
+Creates a 1 Hz square wave going from IO on pin 1 to ground on pin 0
4
+Pin 0 is the upper left pin (closest to lever), pin 1 is the pin below it
5
6
+
7
+from otl866 import bitbang
8
+import time
9
10
+# Open ezbang
11
+# TODO: simplify API here to auto open Bitbang()
12
+eb = bitbang.EzBang()
13
+# Enable power transistor on pin 0, shorting it to ground
14
+eb.gnd_pin(0, True)
15
+# IOs are tristated by default
16
+# Disable tristate to enable IO to drive pin
17
+eb.io_tri_pin(1, False)
18
19
+# Loop at 1 Hz
20
+while True:
21
+ # Drive IO to high logic level (3.3V)
22
+ eb.io_w_pin(1, True)
23
+ time.sleep(0.5)
24
+ # Drive IO to low logic level (0V)
25
+ eb.io_w_pin(1, False)
26
27
0 commit comments