Compare commits
No commits in common. "e7cbbb8226d2d0f74d1f0b4cfa82f767f9c61785" and "78dca5c55939208fb82c60365789b9407f8ee73b" have entirely different histories.
e7cbbb8226
...
78dca5c559
@ -1,31 +0,0 @@
|
||||
from flask import Flask
|
||||
from flask import render_template
|
||||
from flask import redirect
|
||||
from flask import url_for
|
||||
from flask import make_response
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
RELAY_1 = 26
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(RELAY_1,GPIO.OUT)
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/<state>', methods=['POST'])
|
||||
def reroute(state):
|
||||
if state == 'on':
|
||||
GPIO.output(RELAY_1, 0)
|
||||
else:
|
||||
GPIO.output(RELAY_1, 1)
|
||||
|
||||
response = make_response(redirect(url_for('index')))
|
||||
return response
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=False, host='0.0.0.0', port=8000)
|
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Yard Light</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 18px !important;
|
||||
font-family: 'Muli', arial, verdana, helvetica, sans-serif;
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
height: 100%;
|
||||
color: #b6b6b6;
|
||||
background: #282929;
|
||||
}
|
||||
|
||||
body {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
}
|
||||
|
||||
h1 {text-align: center;}
|
||||
p {text-align: center;}
|
||||
div {text-align: center;}
|
||||
|
||||
.button {
|
||||
color: #b6b6b6;
|
||||
background-color: #3d5f69;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 1.2rem;
|
||||
width: 12rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Yard Light</h1>
|
||||
<p>
|
||||
<form action="/on" method="POST">
|
||||
<div><button class="button">On</button></div><br>
|
||||
</form>
|
||||
<form action="/off" method="POST">
|
||||
<div><button class="button">Off</button></div><br>
|
||||
</form>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
python -m weblight $@
|
Loading…
Reference in New Issue
Block a user