Last active
November 6, 2018 09:27
-
-
Save FrankWu100/19911152f9921553345461f48a81a291 to your computer and use it in GitHub Desktop.
TInker LED blink sample code
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
| import ASUS.GPIO as GPIO | |
| import time | |
| LED_Pin = 11 | |
| GPIO.setmode(GPIO.BOARD) #Physical Pin | |
| GPIO.setup(LED_Pin, GPIO.OUT) | |
| while True: | |
| try: #Blink the LED | |
| GPIO.output(LED_Pin, GPIO.HIGH) # Send HIGH to switch on LED | |
| print("LED ON!") | |
| time.sleep(0.5) | |
| GPIO.output(LED_Pin, GPIO.LOW) # Send LOW to switch off LED | |
| print("LED OFF!") | |
| time.sleep(0.5) | |
| except KeyboardInterrupt: # Turn LED off before stopping | |
| GPIO.output(LED_Pin, GPIO.LOW) | |
| break | |
| except IOError: | |
| print ("Error") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment