import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
state = False
while 1:
GPIO.output(11, state)
command = input("Enter:Switch the port / Q:Quit")
if command.upper() == ("Q"):
break
state = not state
GPIO.cleanup()
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
state = False
while 1:
GPIO.output(11, state)
command = input("Enter:Switch the port / Q:Quit")
if command.upper() == ("Q"):
break
state = not state
GPIO.cleanup()
補足
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.OUT) state = False while 1: GPIO.output(11, state) command = input("Enter:Switch the port / Q:Quit") if command.upper() == ("Q"): break state = not state GPIO.cleanup() import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.OUT) state = False while 1: GPIO.output(11, state) command = input("Enter:Switch the port / Q:Quit") if command.upper() == ("Q"): break state = not state GPIO.cleanup()