From 8b0248320d51fed32763662ffaca897fed271e8e Mon Sep 17 00:00:00 2001 From: FluffyCube9343 Date: Sat, 12 Nov 2022 15:34:19 -0500 Subject: [PATCH] basic comms to raspberry pi w/confirmation --- app.py | 18 +++++++++++++++++- static/src/main.css | 5 +++++ templates/base.html | 22 ++++++++++++++-------- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index 629af69..06dde98 100644 --- a/app.py +++ b/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) 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 24b2fd9..7520ced 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,15 +27,21 @@ class="img-part" />

360

- - - +
+ + + +

Deg