diff --git a/app.py b/app.py index 233d661..4cada7e 100644 --- a/app.py +++ b/app.py @@ -27,6 +27,22 @@ def homepage(): 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__": app.run(debug=True) diff --git a/static/src/main.css b/static/src/main.css index 90c4df8..69604d3 100644 --- a/static/src/main.css +++ b/static/src/main.css @@ -213,3 +213,8 @@ a:link, a:visited { text-decoration: none; } + +.enter-angle { + display: flex; + flex-direction: row; +} diff --git a/templates/base.html b/templates/base.html index 856e3f1..b3a0769 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,15 +27,23 @@ class="img-part" /> <p class="measure">360</p> - <label for="fname">Input</label> - <input - class="inputbox" - type="text" - id="userInput" - name="fname" - /> - <button class="button" onclick="server.printinput()">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>