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