User Manual

39
# delay 0.5 second, which is equals to the delay in C language, using second as
the unit,
time.sleep(0.5)
print 'LED OFF...'
# Turn off LED
GPIO.output(LedPin, GPIO.HIGH)
time.sleep(0.5)
# Define a destroy function for clean up everything after the script finished
def destroy():
# Turn off LED
GPIO.output(LedPin, GPIO.HIGH)
# Release resource
GPIO.cleanup()
# If run this script directly, do:
if __name__ == '__main__':
setup()
try:
main()
# When 'Ctrl+C' is pressed, the child program destroy () will be executed.
except KeyboardInterrupt:
destroy()
Press Ctrl+X to exit. I f you have modified the code, there will be a prompt asking whether to
save the changes or not. Type in Y (save) or N (don’t save).
SunFounder