← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.py b/main.py
index 8c0e777..053899c 100644
--- a/main.py
+++ b/main.py
@@ -39,8 +39,11 @@ while client_sock:
read = read.decode("utf-8").strip('\n')
print(read)
- if read == "0": # Do nothing
- if read == "11": # Drive forward
+ if read == "0": # Do nothing
+ GPIO.output(P1, False)
+ GPIO.output(P2, False)
+ GPIO.output(P3, False)
+ elif read == "11": # Drive forward
GPIO.output(P1, True)
GPIO.output(P2, False)
GPIO.output(P3, False)
@@ -68,7 +71,7 @@ while client_sock:
GPIO.output(P1, True)
GPIO.output(P2, True)
GPIO.output(P3, True)
- else: # Do nothing
+ else: # Do nothing if command is not recognized
GPIO.output(P1, False)
GPIO.output(P2, False)
GPIO.output(P3, False)