mirror of
https://github.com/PotentiaRobotics/robot-gui.git
synced 2025-04-20 19:00:16 -04:00
>180 not allowed hehe :P
This commit is contained in:
parent
8644a6f085
commit
f1ea7da8fe
11
app.py
11
app.py
|
@ -35,24 +35,25 @@ def sendData():
|
||||||
|
|
||||||
rot = request.form.get("rot")
|
rot = request.form.get("rot")
|
||||||
try:
|
try:
|
||||||
rot = int(rot)
|
rot = int(rot)%360
|
||||||
|
rot = rot-360 if rot > 180 else rot
|
||||||
print("Activated")
|
print("Activated")
|
||||||
import socket
|
import socket
|
||||||
s=socket.socket()
|
s=socket.socket()
|
||||||
host="raspberrypi" #This is your Server IP!
|
host="raspberrypi" #This is your Server IP!
|
||||||
port=2345
|
port=2345
|
||||||
s.settimeout(5)
|
s.settimeout(10)
|
||||||
s.connect((host,port))
|
s.connect((host,port))
|
||||||
s.send(str(rot).encode())
|
s.send(str(rot).encode())
|
||||||
rece=s.recv(1024)
|
rece=s.recv(1024)
|
||||||
print("Received",rece)
|
print("Received",rece)
|
||||||
s.close()
|
s.close()
|
||||||
rece = "Confirm Sent: "+rece.decode("ASCII")
|
rece = "Confirm Sent: "+rece.decode("ASCII")
|
||||||
return render_template("index.html", conf=rece)
|
return render_template("manual.html", conf=rece)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return render_template("index.html", conf='Invalid Input "'+rot+'"')
|
return render_template("manual.html", conf='Invalid Input "'+rot+'"')
|
||||||
except:
|
except:
|
||||||
return render_template("index.html", conf='Timeout: Unable to reach Pi')
|
return render_template("manual.html", conf='Timeout: Unable to reach Pi')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user