code cleanup

This commit is contained in:
Michael Clemens 2019-09-12 20:30:49 +01:00
parent b89488f602
commit 4558b9d6f4
1 changed files with 1 additions and 9 deletions

View File

@ -10,12 +10,10 @@ 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)
#GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
#GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
@app.route('/')
def start():
return render_template('index.html')
@ -25,21 +23,15 @@ def index():
if request.method == 'POST':
if request.form['ant_button'] == 'Antenna 1':
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
print('Antenna 1 selected')
return redirect(url_for('start'))
if request.form['ant_button'] == 'Antenna 2':
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
print('Antenna 2 selected')
return redirect(url_for('start'))
if request.form['ant_button'] == 'Antenna 3':
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
time.sleep(1)
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
print('Antenna 2 selected')
return redirect(url_for('start'))
else:
print(request.form.action)