# Run the bot until the you presses Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT. This should be used most of the time, since # start_polling() is non-blocking and will stop the bot gracefully. updater.idle() except KeyboardInterrupt: print "Exit" GPIO.cleanup() # clean up GPIO on CTRL+C exit GPIO.cleanup() # clean up GPIO on normal exit if __name__ == '__main__': #Riferimento ai GPIO per numero pin GPIO.setmode(GPIO.BOARD) #GPIO.setwarnings(False) RED = "J4.40" YELLOW = "J4.38" GREEN = "J4.36" GPIO.setup(RED, GPIO.OUT) GPIO.setup(YELLOW, GPIO.OUT) GPIO.setup(GREEN, GPIO.OUT) GPIO.output(RED, 0) GPIO.output(YELLOW, 0) GPIO.output(GREEN, 0) GPIO.pwm_export(0)
try: # Run the bot until the you presses Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT. This should be used most of the time, since # start_polling() is non-blocking and will stop the bot gracefully. updater.idle() except KeyboardInterrupt: print "Exit" GPIO.cleanup() # clean up GPIO on CTRL+C exit GPIO.cleanup() # clean up GPIO on normal exit if __name__ == '__main__': #Riferimento ai GPIO per numero pin GPIO.setmode(GPIO.BOARD) #GPIO.setwarnings(False) RED="J4.40" YELLOW="J4.38" GREEN="J4.36" GPIO.setup(RED, GPIO.OUT) GPIO.setup(YELLOW, GPIO.OUT) GPIO.setup(GREEN, GPIO.OUT) GPIO.output(RED, 0) GPIO.output(YELLOW, 0) GPIO.output(GREEN, 0) main()