Raspbery pi Relay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import RPi.GPIO as GPIO | |
from time import sleep | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setwarnings(False) | |
GPIO.setup(17, GPIO.OUT) # It does Auto set LOW and Turn Relay ON | |
print(GPIO.input(17)) | |
sleep(5) | |
GPIO.output(17, GPIO.HIGH) # Off Relay | |
print(GPIO.input(17)) | |
sleep(5) | |
GPIO.output(17, GPIO.LOW) # ON Relay | |
print(GPIO.input(17)) | |
sleep(5) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment