(theThe green light on the right is the traffic light)
Now, as far as coding goes, I've created a simple Car
class with "forward"forward
, "backward"backward
, "forward_left"forward_left
, "forward_right"forward_right
, "backward_left"backward_left
and "backward_right"backward_right
actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).
The code:
I would also appreciate any points about the code organization and quality since the next step would be to control the car "via bluetooth"Bluetooth".
(the green light on the right is the traffic light)
Now, as far as coding goes, I've created a simple Car
class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).
The code:
I would also appreciate any points about the code organization and quality since the next step would be to control the car "via bluetooth".
(The green light on the right is the traffic light)
Now, as far as coding goes, I've created a simple Car
class with forward
, backward
, forward_left
, forward_right
, backward_left
and backward_right
actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).
I would also appreciate any points about the code organization and quality since the next step would be to control the car "via Bluetooth".
(the green light on the right is the traffic light)
Now, as far as coding goes, I've created a simple Car
class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
Now, as far as coding goes, I've created a simple Car
class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
(the green light on the right is the traffic light)
Now, as far as coding goes, I've created a simple Car
class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.
I've also initialized an endless loop listening for keyboard inputs - f
F would be for forward, b
B for backwards and s
S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).
I've also initialized an endless loop listening for keyboard inputs - f
would be for forward, b
for backwards and s
for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).
I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).