← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/control.py
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-04-09 13:54:25 +0200
committerEdvin <[email protected]>2025-04-09 13:54:25 +0200
commitf52ccfbd1644d3059e67c6e04a91b2c275b307f8 (patch)
tree968b163202a6731de61178dc31e67709774531a9 /control.py
parent59b0200a59969bdbabd3273e5e1de0f325a3fc85 (diff)
Two-way communication attempt #2
Diffstat (limited to 'control.py')
-rw-r--r--control.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/control.py b/control.py
index aa86c1b..8fa33cd 100644
--- a/control.py
+++ b/control.py
@@ -29,6 +29,7 @@ input = "0"
while input != "a":
input = get_input()
+ print("Sending: %s" % input)
if input == "i":
sock.send("11")
elif input == "j":
@@ -39,8 +40,20 @@ while input != "a":
sock.send("22")
else:
sock.send("0")
- print(input)
+
+ read = sock.recv(1024)
+ read = read.decode("utf-8").strip('\n')
+ print("Received: '%s'" % read )
time.sleep(0.1)
+print("Sending: %s" % input)
+sock.send(input)
+
+read = sock.recv(1024)
+read = read.decode("utf-8").strip('\n')
+print("Received: '%s'" % read )
+
+print("Shutting down...")
+
sock.close()