From 7ebf02f98f7eb6bbecf8143f84c263b89d6dc95d Mon Sep 17 00:00:00 2001 From: Harry Esses Date: Fri, 24 Apr 2026 20:41:54 +0000 Subject: [PATCH] Update main.py --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 99a4102..956baec 100644 --- a/main.py +++ b/main.py @@ -19,6 +19,7 @@ top_motor = Motor(Ports.PORT8, GearSetting.RATIO_18_1, False) bottom_motor = Motor(Ports.PORT3, GearSetting.RATIO_18_1, True) run_bottom_motor = False run_invert_bottom_motor = False +speed_modifer = 1 def intake(): top_motor.spin(FORWARD, 100, PERCENT) # bottom_motor.spin(FORWARD, 100, PERCENT) @@ -49,6 +50,12 @@ def user_control(): # place driver control in this while loop brain.screen.new_line() while True: + if controller.buttonR1.pressing(): + speed_modifer = speed_modifer + 0.1 + if controller.buttonR2.pressing(): + speed_modifer = speed_modifer - 0.1 + if controller.buttonB.pressing(): + speed_modifer = 1 brain.sdcard.savefile("motors/left_motor/velocity.txt", bytearray(str(left_motor.velocity()))) brain.sdcard.savefile("motors/left_motor/power.txt", bytearray(str(left_motor.power()))) brain.sdcard.savefile("motors/left_motor/torque.txt", bytearray(str(left_motor.torque()))) @@ -58,7 +65,7 @@ def user_control(): if run_invert_bottom_motor: not run_invert_bottom_motor bottom_motor.spin(FORWARD, 100, PERCENT) - top_motor.spin(FORWARD, 100, PERCENT) + top_motor.spin(FORWARD, 100 * speed_modifer, PERCENT) elif run_invert_bottom_motor: if run_bottom_motor: not run_bottom_motor