mirror of
https://github.com/PotentiaRobotics/robot-gui.git
synced 2025-04-09 14:20:16 -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
|
||||
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, request
|
||||
from flask_assets import Bundle, Environment
|
||||
|
||||
app = Flask(__name__)
|
||||
|
@ -16,6 +16,22 @@ css.build()
|
|||
def homepage():
|
||||
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__":
|
||||
app.run(debug=True)
|
||||
|
|
|
@ -213,3 +213,8 @@ a:link,
|
|||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.enter-angle {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
|
|
@ -27,15 +27,21 @@
|
|||
class="img-part"
|
||||
/>
|
||||
<p class="measure">360</p>
|
||||
<label for="fname">Input</label>
|
||||
|
||||
<input
|
||||
class="inputbox"
|
||||
type="text"
|
||||
id="fname"
|
||||
name="fname"
|
||||
/>
|
||||
<button class="button">Enter</button>
|
||||
<form
|
||||
action='{{ url_for("sendData")}}'
|
||||
class="enter-angle"
|
||||
method="POST"
|
||||
>
|
||||
<label for="rot">Input</label>
|
||||
<input
|
||||
class="inputbox"
|
||||
type="text"
|
||||
id="rot"
|
||||
name="rot"
|
||||
/>
|
||||
<input type="submit" value="Enter" />
|
||||
</form>
|
||||
<p class="units">Deg</p>
|
||||
<select name="input" id="unit">
|
||||
<option value="Position">Position</option>
|
||||
|
|
Loading…
Reference in New Issue
Block a user