diff options
| author | Edvin <[email protected]> | 2025-04-09 15:40:25 +0200 |
|---|---|---|
| committer | Edvin <[email protected]> | 2025-04-09 15:40:25 +0200 |
| commit | 1a837cbe411b4522582d323454a03ef02e9dd292 (patch) | |
| tree | eaa25999305acf4198cf2825149a4fb3d8943c60 /main.py | |
| parent | f52ccfbd1644d3059e67c6e04a91b2c275b307f8 (diff) | |
Functional two-way communication
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -32,18 +32,15 @@ recv_sock, client_info = server_sock.accept() print("Connected to %s." % client_info[0]) -send_sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM) -send_sock.connect((client_info[0], 2)) +read = "0" -print("Created sending socket to %s" % client_info[0]) - -while read != "a": +while read != "1000": read = recv_sock.recv(1024) read = read.decode("utf-8").strip('\n') print("Received: %s" % read) - send_sock.send("Acknowledge: " + read) - print("Sent acknowledge") + print(f"Sending: 'Acknowledge: {read}'") + client_sock.send(f"Acknowledge: {read}\n".encode()) # Remember NEW LINE for ÖS to be able to read lines. if read == "0": # Do nothing GPIO.output(P1, False) |
