Archived
1
0
This repository has been archived on 2025-04-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
garden/relay/relay.py
2021-11-06 16:54:38 -04:00

37 lines
801 B
Python

#! env/bin/python3
import RPi.GPIO as GPIO
import time
if __name__ == "__main__":
# Setup for Hardware
RELAY1_PIN = 26
RELAY2_PIN = 20
RELAY3_PIN = 21
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Setup the output pin; initialize OFF.
GPIO.setup(RELAY1_PIN, GPIO.OUT)
GPIO.output(RELAY1_PIN, False)
GPIO.setup(RELAY2_PIN, GPIO.OUT)
GPIO.output(RELAY2_PIN, False)
GPIO.setup(RELAY3_PIN, GPIO.OUT)
GPIO.output(RELAY3_PIN, False)
# Short toggle.
i = 0
try:
time.sleep(10.0)
GPIO.output(RELAY1_PIN, True)
GPIO.output(RELAY3_PIN, True)
time.sleep(60.0)
GPIO.output(RELAY1_PIN, False)
GPIO.output(RELAY3_PIN, False)
time.sleep(1.0)
finally:
GPIO.cleanup()