diff options
| author | Edvin <[email protected]> | 2025-05-07 13:41:49 +0200 |
|---|---|---|
| committer | Edvin <[email protected]> | 2025-05-07 13:41:49 +0200 |
| commit | 9e5aabc05c41365bffeedc20fe50be26cb02bbbb (patch) | |
| tree | fdd8d3fa0ad673bf867b09f31e3faf8734e131b5 /main.py | |
| parent | 0c1cbed626f914b9c5ce85e8d9b29ea0b15e027b (diff) | |
Improved LIDAR implementations
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -200,18 +200,19 @@ if bto.find("Connected") != -1: sleep(1) GPIO.output(LED, False) - iteration += 1 - - if iteration == 10: - with open("distances.txt", "r") as f: - for line in f: - a, d = line.split() - a = int(a) - d = int(d) - - if (a < 20 or a > 340) and d < 20: - print("Something in front") - forward = False + with open("distances.txt", "r") as f: + for line in f: + a, d = line.split() + a = int(a) + d = int(d) + + if (a < 20 or a > 340) and d < 300: + forward = False + if backward == False: + NANO.write(b"Stop\n") + + if (a > 160 and a < 200): + print(f"{a}, {d}") if forward: NANO.write(b"Forward\n") |
