[Add] First commit
This commit is contained in:
15
Pioneer600_code/KEY/python/Interrupt.py
Normal file
15
Pioneer600_code/KEY/python/Interrupt.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
KEY = 20
|
||||
|
||||
def MyInterrupt(KEY):
|
||||
print("KEY PRESS")
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(KEY,GPIO.IN,GPIO.PUD_UP)
|
||||
GPIO.add_event_detect(KEY,GPIO.FALLING,MyInterrupt,200)
|
||||
|
||||
while True:
|
||||
time.sleep(1)
|
||||
Reference in New Issue
Block a user