mirror of
https://github.com/pybricks/pybricks-projects.git
synced 2026-07-28 04:06:07 +00:00
sets/technic/*/remote: swap left/right controls (#68)
In RC toys, there is a defacto standard that throttle is on the left and steering is on the right, so this configuration should be more natural to anyone who has used other RC toys.
This commit is contained in:
@@ -29,21 +29,21 @@ while True:
|
||||
# Check which buttons are pressed.
|
||||
pressed = remote.buttons.pressed()
|
||||
|
||||
# Choose the steer angle based on the left controls.
|
||||
# Choose the steer angle based on the right controls.
|
||||
steer_angle = 0
|
||||
if Button.LEFT_PLUS in pressed:
|
||||
if Button.RIGHT_MINUS in pressed:
|
||||
steer_angle -= 75
|
||||
if Button.LEFT_MINUS in pressed:
|
||||
if Button.RIGHT_PLUS in pressed:
|
||||
steer_angle += 75
|
||||
|
||||
# Steer to the selected angle.
|
||||
steer.run_target(500, steer_angle, wait=False)
|
||||
|
||||
# Choose the drive speed based on the right controls.
|
||||
# Choose the drive speed based on the left controls.
|
||||
drive_speed = 0
|
||||
if Button.RIGHT_PLUS in pressed:
|
||||
if Button.LEFT_PLUS in pressed:
|
||||
drive_speed += 1000
|
||||
if Button.RIGHT_MINUS in pressed:
|
||||
if Button.LEFT_MINUS in pressed:
|
||||
drive_speed -= 1000
|
||||
|
||||
# Apply the selected speed.
|
||||
|
||||
@@ -27,21 +27,21 @@ while True:
|
||||
# Check which buttons are pressed.
|
||||
pressed = remote.buttons.pressed()
|
||||
|
||||
# Choose the steer angle based on the left controls.
|
||||
# Choose the steer angle based on the right controls.
|
||||
steer_angle = 0
|
||||
if Button.LEFT_PLUS in pressed:
|
||||
if Button.RIGHT_MINUS in pressed:
|
||||
steer_angle -= 75
|
||||
if Button.LEFT_MINUS in pressed:
|
||||
if Button.RIGHT_PLUS in pressed:
|
||||
steer_angle += 75
|
||||
|
||||
# Steer to the selected angle.
|
||||
steer.run_target(500, steer_angle, wait=False)
|
||||
|
||||
# Choose the drive speed based on the right controls.
|
||||
# Choose the drive speed based on the left controls.
|
||||
drive_speed = 0
|
||||
if Button.RIGHT_PLUS in pressed:
|
||||
if Button.LEFT_PLUS in pressed:
|
||||
drive_speed += 1000
|
||||
if Button.RIGHT_MINUS in pressed:
|
||||
if Button.LEFT_MINUS in pressed:
|
||||
drive_speed -= 1000
|
||||
|
||||
# Apply the selected speed.
|
||||
|
||||
Reference in New Issue
Block a user