changed a lot

This commit is contained in:
Michael Clemens 2019-09-11 20:01:06 +01:00
parent 03b34d6fa8
commit b89488f602
2 changed files with 12 additions and 5 deletions

View File

@ -13,8 +13,8 @@ RELAIS_2_GPIO = 1
GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) GPIO.setup(RELAIS_1_GPIO, GPIO.OUT)
GPIO.setup(RELAIS_2_GPIO, GPIO.OUT) GPIO.setup(RELAIS_2_GPIO, GPIO.OUT)
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) #GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH) #GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
@app.route('/') @app.route('/')
def start(): def start():
@ -35,10 +35,11 @@ def index():
GPIO.output(RELAIS_2_GPIO, GPIO.LOW) GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
print('Antenna 2 selected') print('Antenna 2 selected')
return redirect(url_for('start')) return redirect(url_for('start'))
if request.form['ant_button'] == 'Antenna Off': if request.form['ant_button'] == 'Antenna 3':
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH) GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
print('Off: No antenna attached') print('Antenna 2 selected')
return redirect(url_for('start')) return redirect(url_for('start'))
else: else:
print(request.form.action) print(request.form.action)

View File

@ -1,14 +1,20 @@
<html> <html>
<head>
<title>AntennaPi</title>
</head>
<body> <body>
<form action = "/index" method = "post"> <form action = "/index" method = "post">
<div> <div>
<input type ="submit" name="ant_button" value="Antenna 1"> <input type ="submit" name="ant_button" value="Antenna 1">
X200
</div> </div>
<div> <div>
<input type ="submit" name="ant_button" value="Antenna 2"> <input type ="submit" name="ant_button" value="Antenna 2">
20m Dipol
</div> </div>
<div> <div>
<input type ="submit" name="ant_button" value="Antenna Off"> <input type ="submit" name="ant_button" value="Antenna 3">
40-20-10 Windom
</div> </div>
</form> </form>
</body> </body>