31 lines
440 B
Python
31 lines
440 B
Python
#!/usr/bin/python
|
|
# -*- coding:utf-8 -*-
|
|
|
|
import RPi.GPIO as GPIO
|
|
import time
|
|
import spidev
|
|
|
|
def main():
|
|
LED = 26
|
|
|
|
GPIO.setwarnings(False)
|
|
|
|
GPIO.setmode(GPIO.BCM)
|
|
GPIO.setup(LED,GPIO.OUT)
|
|
|
|
spi = spidev.SpiDev()
|
|
|
|
try:
|
|
while True:
|
|
GPIO.output(LED,GPIO.HIGH)
|
|
time.sleep(1)
|
|
GPIO.output(LED,GPIO.LOW)
|
|
time.sleep(1)
|
|
except:
|
|
print("except")
|
|
GPIO.output(LED,GPIO.HIGH)
|
|
GPIO.cleanup()
|
|
|
|
if __name__=='__main__':
|
|
main()
|