38
# 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. If 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).
Содержание Super Kit 3.0
Страница 7: ...4 22 RGB LED 1 23 LED red 8 24 LED white 4 25 LED green 4 26 LED yellow 4 27 NPN Transistor S8050 2 ...
Страница 30: ...27 Also we have drawn a table of the corresponding BCM wiringPi and Name of each pins ...
Страница 78: ...75 Now pull the slide and you can see the two LEDs light up alternately ...