Created
July 23, 2019 14:41
-
-
Save izzuddin91/2db3b223224af9639a526595048bbe0f to your computer and use it in GitHub Desktop.
setting up relay for hydroponic projects
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
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library | |
from time import sleep # Import the sleep function from the time module | |
GPIO.setwarnings(False) # Ignore warning for now | |
GPIO.setmode(GPIO.BOARD) # Use physical pin numbering | |
GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and s$ | |
while True: # Run forever | |
GPIO.output(8, GPIO.HIGH) # Turn on | |
sleep(1) # Sleep for 1 second -> use this to set the interval for water pump | |
GPIO.output(8, GPIO.LOW) # Turn off | |
sleep(1) # Sleep for 1 second |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment