AntennaPi/antennapi.py
Michael Clemens b26b99c5de first commit
2019-07-06 21:09:59 +01:00

28 lines
587 B
Python

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")