Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- from time import sleep
- GPIO.setmode(GPIO.BCM)
- GPIO.setwarnings(False)
- Relay_PIN = 23
- GPIO.setup(Relay_PIN, GPIO.OUT)
- print('[press ctrl+c to end the script]')
- try: # Main program loop
- while True:
- GPIO.output(Relay_PIN, GPIO.HIGH)
- print('Normally opened pin is HIGH')
- sleep(1) # Waitmode for 1 second
- GPIO.output(Relay_PIN, GPIO.LOW)
- print('Normally opened pin is LOW')
- sleep(1) # Waitmode for 1 second
- # Scavenging work after the end of the program
- except KeyboardInterrupt:
- print('Script end!')
- finally:
- GPIO.cleanup()
Add Comment
Please, Sign In to add comment