mirror of
https://github.com/PotentiaRobotics/robot-gui.git
synced 2025-04-20 11:00:15 -04:00
if(invalid){don't send;}
This commit is contained in:
parent
5fe0a0ef59
commit
91b6386172
30
app.py
30
app.py
|
@ -20,20 +20,22 @@ def homepage():
|
||||||
def sendData():
|
def sendData():
|
||||||
|
|
||||||
rot = request.form.get("rot")
|
rot = request.form.get("rot")
|
||||||
|
try:
|
||||||
print("Activated")
|
rot = int(rot)
|
||||||
import socket
|
print("Activated")
|
||||||
s=socket.socket()
|
import socket
|
||||||
host="raspberrypi" #This is your Server IP!
|
s=socket.socket()
|
||||||
port=2345
|
host="raspberrypi" #This is your Server IP!
|
||||||
s.connect((host,port))
|
port=2345
|
||||||
s.send(str(rot).encode())
|
s.connect((host,port))
|
||||||
rece=s.recv(1024)
|
s.send(str(rot).encode())
|
||||||
print("Received",rece)
|
rece=s.recv(1024)
|
||||||
s.close()
|
print("Received",rece)
|
||||||
rece = "Confirm Sent: "+rece.decode("ASCII")
|
s.close()
|
||||||
return render_template("index.html", conf=rece)
|
rece = "Confirm Sent: "+rece.decode("ASCII")
|
||||||
|
return render_template("index.html", conf=rece)
|
||||||
|
except ValueError:
|
||||||
|
return render_template("index.html", conf='Invalid Input "'+rot+'"')
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user