import RPi.GPIO as GPIO import time mot = 23 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(mot,GPIO.OUT) print "CTRL+C = STOP program" try: while True: GPIO.output(mot,GPIO.HIGH) time.sleep(0.1) GPIO.output(mot,GPIO.LOW) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup() # must be executed before program stop