Archived
1
0

Adding relay output test program.

This commit is contained in:
Shaun Setlock
2021-10-17 20:55:25 -04:00
parent 879a21445d
commit 9f3da5e663
4 changed files with 47 additions and 1 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "relay/venv/bin/python3"
}

View File

@@ -18,7 +18,7 @@ if __name__ == "__main__":
i = 0
try:
while True:
if not GPIO.input(PB_PIN):
if GPIO.input(PB_PIN):
i += 1
print(f"Hi Gabby! Did you push the button? i = {i}")
time.sleep(0.1)

30
relay/relay.py Normal file
View File

@@ -0,0 +1,30 @@
#! 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)
# Short toggle.
i = 0
try:
time.sleep(1.0)
GPIO.output(RELAY1_PIN, True)
time.sleep(2.0)
GPIO.output(RELAY1_PIN, False)
time.sleep(1.0)
finally:
GPIO.cleanup()

13
relay/requirements.txt Normal file
View File

@@ -0,0 +1,13 @@
black==21.9b0
click==8.0.3
importlib-metadata==4.8.1
mypy-extensions==0.4.3
pathspec==0.9.0
pkg-resources==0.0.0
platformdirs==2.4.0
regex==2021.10.8
RPi.GPIO==0.7.0
tomli==1.2.1
typed-ast==1.4.3
typing-extensions==3.10.0.2
zipp==3.6.0