Commits

Brian Thorne committed d55d654

Rename the example I couldn't find at Kiwi PyCon.

Comments (0)

Files changed (2)

can_controlled_car.py

+import threading
+import queue
+
+from real_raw_can import filtered_receiver
+from bluetooth_car import BluetoothCar
+
+
+def can_drive_car(stop, q):
+    car = BluetoothCar()
+    duration = 0.1
+    commands = {
+        'up': car.forwards,
+        'down': car.reverse,
+        'left': car.left,
+        'right': car.right
+        }
+    while not stop.is_set():
+        command = q.get().decode()
+        if command in commands:
+            commands[command](duration)
+        
+
+if __name__ == "__main__":
+    stop = threading.Event()
+    q = queue.Queue()
+    # Start a direction message monitor
+    threading.Thread(target=filtered_receiver, args=(stop, 0x0042, q)).start()
+    can_drive_car(stop, q)

car_car.py

-import threading
-import queue
-
-from real_raw_can import filtered_receiver
-from bluetooth_car import BluetoothCar
-
-
-
-def can_drive_car(stop, q):
-    car = BluetoothCar()
-    duration = 0.1
-    commands = {
-        'up': car.forwards,
-        'down': car.reverse,
-        'left': car.left,
-        'right': car.right
-        }
-    while not stop.is_set():
-        command = q.get().decode()
-        if command in commands:
-            commands[command](duration)
-        
-
-if __name__ == "__main__":
-    stop = threading.Event()
-    q = queue.Queue()
-    # Start a direction message monitor
-    threading.Thread(target=filtered_receiver, args=(stop, 0x0042, q)).start()
-    can_drive_car(stop, q)