To make the LED flash, we are going to write a short Python program, so exit the Python Console by typing:
>>> exit()
This should take you back to the Linux prompt.
Enter the following command to create a new files called blink.py
Enter the following command to create a new files called blink.py
# nano blink.py
Now paste the code below into the editor window.
import Adafruit_BBIO.GPIO as GPIO import time GPIO.setup("P8_10", GPIO.OUT) while True: GPIO.output("P8_10", GPIO.HIGH) time.sleep(0.5) GPIO.output("P8_10", GPIO.LOW) time.sleep(0.5)
Save and exit the editor using CTRL-x and the Y to confirm.
To start the program, enter the command:
To start the program, enter the command:
# python blink.py
When you want to stop the blinking, use CTRL-c to exit the program.
Page last edited June 17, 2013
Text editor powered by tinymce.