<filename>lab12/IRtest2.py
"""
$      If KEY_2 is pressed,this script will be executed,LED1 will turn on(or off)
$      LED2 connect to GPIO6(BCM_GPIO 25)
"""
import RPi.GPIO as GPIO

PIN = 25

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(PIN, GPIO.IN)
GPIO.setup(PIN, GPIO.OUT)

if GPIO.input(PIN) == 0:
     GPIO.output(PIN, GPIO.HIGH)
else:
     GPIO.output(PIN, GPIO.LOW)
<filename>lab12/IRtest2.py
"""
$      If KEY_2 is pressed,this script will be executed,LED1 will turn on(or off)
$      LED2 connect to GPIO6(BCM_GPIO 25)
"""
import RPi.GPIO as GPIO

PIN = 25

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(PIN, GPIO.IN)
GPIO.setup(PIN, GPIO.OUT)

if GPIO.input(PIN) == 0:
     GPIO.output(PIN, GPIO.HIGH)
else:
     GPIO.output(PIN, GPIO.LOW)
$      If KEY_2 is pressed,this script will be executed,LED1 will turn on(or off) $      LED2 connect to GPIO6(BCM_GPIO 25)