mirror of
https://codeberg.org/mclemens/AntennaPi.git
synced 2024-11-10 17:46:08 -05:00
28 lines
587 B
Python
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")
|