mirror of
https://github.com/PotentiaRobotics/robot-gui.git
synced 2025-04-20 11:00:15 -04:00
basic comms to raspberry pi w/confirmation
This commit is contained in:
parent
a372b0fd9b
commit
8b0248320d
18
app.py
18
app.py
|
@ -1,6 +1,6 @@
|
||||||
# app.py
|
# app.py
|
||||||
|
|
||||||
from flask import Flask, render_template
|
from flask import Flask, render_template, request
|
||||||
from flask_assets import Bundle, Environment
|
from flask_assets import Bundle, Environment
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
@ -16,6 +16,22 @@ css.build()
|
||||||
def homepage():
|
def homepage():
|
||||||
return render_template("index.html")
|
return render_template("index.html")
|
||||||
|
|
||||||
|
@app.route("/base.html", methods =["GET", "POST"])
|
||||||
|
def sendData():
|
||||||
|
|
||||||
|
rot = request.form.get("rot")
|
||||||
|
|
||||||
|
print("Activated")
|
||||||
|
import socket
|
||||||
|
s=socket.socket()
|
||||||
|
host="raspberrypi" #This is your Server IP!
|
||||||
|
port=2345
|
||||||
|
s.connect((host,port))
|
||||||
|
s.send(str(rot).encode())
|
||||||
|
rece=s.recv(1024)
|
||||||
|
print("Received",rece)
|
||||||
|
s.close()
|
||||||
|
return render_template("index.html")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
|
@ -213,3 +213,8 @@ a:link,
|
||||||
a:visited {
|
a:visited {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.enter-angle {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
|
@ -27,15 +27,21 @@
|
||||||
class="img-part"
|
class="img-part"
|
||||||
/>
|
/>
|
||||||
<p class="measure">360</p>
|
<p class="measure">360</p>
|
||||||
<label for="fname">Input</label>
|
|
||||||
|
|
||||||
<input
|
<form
|
||||||
class="inputbox"
|
action='{{ url_for("sendData")}}'
|
||||||
type="text"
|
class="enter-angle"
|
||||||
id="fname"
|
method="POST"
|
||||||
name="fname"
|
>
|
||||||
/>
|
<label for="rot">Input</label>
|
||||||
<button class="button">Enter</button>
|
<input
|
||||||
|
class="inputbox"
|
||||||
|
type="text"
|
||||||
|
id="rot"
|
||||||
|
name="rot"
|
||||||
|
/>
|
||||||
|
<input type="submit" value="Enter" />
|
||||||
|
</form>
|
||||||
<p class="units">Deg</p>
|
<p class="units">Deg</p>
|
||||||
<select name="input" id="unit">
|
<select name="input" id="unit">
|
||||||
<option value="Position">Position</option>
|
<option value="Position">Position</option>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user