]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Add example to blink LED on BeagleBone
authorDrew Fustini <drew@pdp7.com>
Thu, 18 Oct 2018 15:56:50 +0000 (15:56 +0000)
committerDrew Fustini <drew@pdp7.com>
Thu, 18 Oct 2018 15:56:50 +0000 (15:56 +0000)
examples/bbb_digitalio.py [new file with mode: 0644]

diff --git a/examples/bbb_digitalio.py b/examples/bbb_digitalio.py
new file mode 100644 (file)
index 0000000..a595710
--- /dev/null
@@ -0,0 +1,22 @@
+# Example of blinking LED on BeagleBone Black
+# https://www.adafruit.com/product/1876
+#
+# Wire the circuit as follows: 
+# 1) connect anode (+) lead of LED to P9.12 pin
+# 2) connect cathode (-) lead to 1K Ohm resistor
+# 3) connect that 1K Ohm resistor to DGND (P9.1)
+
+import time
+import board
+import digitalio
+
+print("hello blinky!")
+
+led = digitalio.DigitalInOut(board.P9_12)
+led.direction = digitalio.Direction.OUTPUT
+
+while True:
+    led.value = True
+    time.sleep(0.5)
+    led.value = False
+    time.sleep(0.5)