Created
November 7, 2021 12:07
-
-
Save s4l1h/a1a016e55e9aa055007e539915cfdbc2 to your computer and use it in GitHub Desktop.
Raspbery pi Relay
This file contains hidden or 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