Ok so recently I was creating a code for our catapult, however the catapult was going quite fast and I wanted to make it so it started at a certain speed and you could use up or down arrows to change the speed accordingly( say the motor velocity starts at 50, you could press the up button to increase it by 5
and press it again to make the velocity 60 and vise versa. I generally code in python but not the vex code so I am not sure if this code will work, I was wondering if this code would work and if not what I could do to fix it.
x=50
Left_Catapult.set_velocity(x,PERCENT)
Right_Catapult.set_velocity(x,PERCENT)
def controller_Up_Pressed():
x+=5
controller_1.buttonUp.pressed(controller_Up_Pressed)
def controller_Down_Pressed():
x-=5
controller_1.buttonDown.pressed(controller_Down_Pressed)
while True:
controller_1.screen.print("The current catapult velocity is", x)
Thank you