#!/usr/bin/env python2 import time import RPi.GPIO as GPIO IR_PIN = 3 GPIO.setmode(GPIO.BOARD) GPIO.setup(IR_PIN, GPIO.OUT) try: while True: print "Gpio Low" GPIO.output(IR_PIN, GPIO.LOW) time.sleep(20) print "Gpio High" GPIO.output(IR_PIN, GPIO.HIGH) time.sleep(20) except Exception as e: print e finally: GPIO.cleanup()