first commit

This commit is contained in:
Michael Clemens 2019-07-06 21:09:59 +01:00
parent 6f2b02e076
commit b26b99c5de

27
antennapi.py Normal file
View File

@ -0,0 +1,27 @@
import RPi.GPIO as GPIO
import sys
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
RELAIS_1_GPIO = 0
RELAIS_2_GPIO = 1
GPIO.setup(RELAIS_1_GPIO, GPIO.OUT)
GPIO.setup(RELAIS_2_GPIO, GPIO.OUT)
antenna = sys.argv[1]
if antenna == "dipol":
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
elif antenna == "diamond":
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
elif antenna == "off":
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
else:
print("nope")