Update main.py
This commit is contained in:
9
main.py
9
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)
|
bottom_motor = Motor(Ports.PORT3, GearSetting.RATIO_18_1, True)
|
||||||
run_bottom_motor = False
|
run_bottom_motor = False
|
||||||
run_invert_bottom_motor = False
|
run_invert_bottom_motor = False
|
||||||
|
speed_modifer = 1
|
||||||
def intake():
|
def intake():
|
||||||
top_motor.spin(FORWARD, 100, PERCENT)
|
top_motor.spin(FORWARD, 100, PERCENT)
|
||||||
# bottom_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
|
# place driver control in this while loop
|
||||||
brain.screen.new_line()
|
brain.screen.new_line()
|
||||||
while True:
|
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/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/power.txt", bytearray(str(left_motor.power())))
|
||||||
brain.sdcard.savefile("motors/left_motor/torque.txt", bytearray(str(left_motor.torque())))
|
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:
|
if run_invert_bottom_motor:
|
||||||
not run_invert_bottom_motor
|
not run_invert_bottom_motor
|
||||||
bottom_motor.spin(FORWARD, 100, PERCENT)
|
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:
|
elif run_invert_bottom_motor:
|
||||||
if run_bottom_motor:
|
if run_bottom_motor:
|
||||||
not run_bottom_motor
|
not run_bottom_motor
|
||||||
|
|||||||
Reference in New Issue
Block a user