Skip to content
Snippets Groups Projects
Commit 00585371 authored by acscharf's avatar acscharf
Browse files

sss

parent 4c847271
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,10 @@ function updateKey(e) { ...@@ -67,6 +67,10 @@ function updateKey(e) {
document.getElementById("rightArrow").style.color = "green"; document.getElementById("rightArrow").style.color = "green";
send_data("d"); send_data("d");
} }
else if (e.keyCode == '32') {
// right (d)
send_data("stop");
}
} }
// reset the key to the start state // reset the key to the start state
......
...@@ -6,6 +6,7 @@ import json ...@@ -6,6 +6,7 @@ import json
HOST = "192.168.0.156" # IP address of your Raspberry PI HOST = "192.168.0.156" # IP address of your Raspberry PI
PORT = 65432 # Port to listen on (non-privileged ports are > 1023) PORT = 65432 # Port to listen on (non-privileged ports are > 1023)
power_val = 10
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT)) s.bind((HOST, PORT))
...@@ -21,19 +22,18 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: ...@@ -21,19 +22,18 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
if command: if command:
if command == 'w': if command == 'w':
fc.forward(power_val) fc.forward(power_val)
client.send("Moving forward")
elif command == 'a': elif command == 'a':
fc.turn_left(power_val) fc.turn_left(power_val)
client.send("Turning left") print("Turning left")
elif command == 's': elif command == 's':
fc.backward(power_val) fc.backward(power_val)
client.send("Moving back") print("Moving back")
elif command == 'd': elif command == 'd':
fc.turn_right(power_val) fc.turn_right(power_val)
client.send("Turning right") print("Turning right")
elif command == 'stop': elif command == 'stop':
fc.stop() fc.stop()
client.send("Stopping") print("Stopping")
else: else:
print("Unrecognized command") print("Unrecognized command")
print(data) print(data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment