Now that we have our transistor driving the LED at its full current from GPIO0_30 (P9.11), let's use Adafruit_BBIO to write a program that blinks it at a fixed interval. The first step is to load the universal-io Device Tree overlay as described previously:
# echo cape-universaln > /sys/devices/bone_capemgr.*/slots
Next you'll need to use the config-pin
command to manually configure the pin as a digital output:
# config-pin P9_11 in
Now that the pin is configured properly, open a new file in Cloud9 called blink.py
with the following code:
from Adafruit_BBIO import GPIO import time LED_PIN = "GPIO0_30" GPIO.setup(LED_PIN, GPIO.OUT) while True: GPIO.output(LED_PIN, GPIO.HIGH) time.sleep(0.5) GPIO.output(LED_PIN, GPIO.LOW) time.sleep(0.5)
Press Run and you should see the LED turn on for half a second, turn off for half a second, and repeat forever. Alright! When you're done watching the light show you can press the Stop button or hit Ctrl + C in the terminal that opened when...