mirror of
https://github.com/PotentiaRobotics/robot-gui.git
synced 2025-04-20 19:00:16 -04:00
Merge pull request #1 from PotentiaRobotics/rpicommdev
basic comms to raspberry pi w/confirmation
This commit is contained in:
commit
518899e07a
16
app.py
16
app.py
|
@ -27,6 +27,22 @@ def homepage():
|
||||||
|
|
||||||
return App.render(render_template("index.html"))
|
return App.render(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,23 @@
|
||||||
class="img-part"
|
class="img-part"
|
||||||
/>
|
/>
|
||||||
<p class="measure">360</p>
|
<p class="measure">360</p>
|
||||||
<label for="fname">Input</label>
|
|
||||||
|
|
||||||
|
|
||||||
|
<form
|
||||||
|
action='{{ url_for("sendData")}}'
|
||||||
|
class="enter-angle"
|
||||||
|
method="POST"
|
||||||
|
>
|
||||||
|
<label for="rot">Input</label>
|
||||||
<input
|
<input
|
||||||
class="inputbox"
|
class="inputbox"
|
||||||
type="text"
|
type="text"
|
||||||
id="userInput"
|
id="rot"
|
||||||
name="fname"
|
name="rot"
|
||||||
/>
|
/>
|
||||||
<button class="button" onclick="server.printinput()">Enter</button>
|
<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