Last active
August 29, 2015 14:09
-
-
Save petebachant/114c8088660ea8e2f238 to your computer and use it in GitHub Desktop.
Toggle a BeagleBone digital output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from Adafruit_BBIO import GPIO | |
| pin = "P8_13" | |
| exit = False | |
| state = 1 | |
| GPIO.setup(pin, GPIO.OUT) | |
| while not exit: | |
| exit = (raw_input("Press any key to toggle output, or 'exit()' to exit >> ") == "exit()") | |
| if state == 1: | |
| GPIO.output(pin, GPIO.HIGH) | |
| else: | |
| GPIO.output(pin, GPIO.LOW) | |
| state *= -1 | |
| GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment