]> Repositories - Adafruit_Blinka-hackapet.git/blob - examples/pb_digitalio.py
[examples] make executable
[Adafruit_Blinka-hackapet.git] / examples / pb_digitalio.py
1 # Example of blinking LED on PocketBeagle
2 # https://www.adafruit.com/product/4179
3 #
4 # Wire the circuit as follows:
5 # 1) connect anode (+) lead of LED to P1_33 pin
6 # 2) connect cathode (-) lead to 1K Ohm resistor
7 # 3) connect that 1K Ohm resistor to GND
8 #
9 # NOTE: the pin mode can be verified with the command line
10 # utility config-pin on the BeagleBoard.org Debian image
11 #
12 # To verify the pin is in GPIO mode:
13 # debian@beaglebone:~$ config-pin -q p1.33
14 # P1_33 Mode: gpio Direction: out Value: 0
15 #
16 # To set pin to GPIO mode:
17 # $ config-pin p1.33 gpio
18
19 import time
20 import board
21 import digitalio
22
23 print("hello blinky!")
24
25 led = digitalio.DigitalInOut(board.P1_33)
26 led.direction = digitalio.Direction.OUTPUT
27
28 while True:
29     led.value = True
30     time.sleep(0.5)
31     led.value = False
32     time.sleep(0.5)