diff options
Diffstat (limited to 'bt.py')
| -rwxr-xr-x | bt.py | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -39,15 +39,27 @@ while read != "1000": # message = message + read # Send DWM data - with open("position.txt", "r") as f: - for line in f: - line = line.strip("\n") - x, y = line.split(",") - x = int(x) - y = int(y) - recv_sock.send(f"{x}, {y}, ".encode()) - # message = message + f"{x}, {y}, " - f.close() + if read == "10": + sleep(1) + with open("position_mean.txt", "r") as f: + for line in f: + line = line.strip("\n") + x, y = line.split(",") + x = int(x) + y = int(y) + recv_sock.send(f"{x}, {y}, ".encode()) + # message = message + f"{x}, {y}, " + f.close() + else: + with open("position.txt", "r") as f: + for line in f: + line = line.strip("\n") + x, y = line.split(",") + x = int(x) + y = int(y) + recv_sock.send(f"{x}, {y}, ".encode()) + # message = message + f"{x}, {y}, " + f.close() # Send angle data with open("angle.txt", "r") as f: |
