From f52ccfbd1644d3059e67c6e04a91b2c275b307f8 Mon Sep 17 00:00:00 2001 From: Edvin Date: Wed, 9 Apr 2025 13:54:25 +0200 Subject: Two-way communication attempt #2 --- control.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'control.py') 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() -- cgit v1.2.3