Is my code good

def conveyer_forward():
CONVEYER.spin(FORWARD)

def conveyer_reverse():
CONVEYER.spin(REVERSE)

def conveyer_stop():
CONVEYER.stop()

def lift_forward():
LIFT.spin(FORWARD)

def lift_reverse():
LIFT.spin(REVERSE)

def lift_stop():
LIFT.stop()

def threebar_forward():
THREEBAR.spin(FORWARD)

def threebar_reverse():
THREEBAR.spin(REVERSE)

def threebar_stop():
THREEBAR.stop()

def spinner_forward():
SPINNER.spin(FORWARD)

def spinner_reverse():
SPINNER.spin(REVERSE)

def spinner_stop():
SPINNER.stop()

controller_1.buttonL1.pressed(conveyer_forward)
controller_1.buttonL1.released(conveyer_stop)

controller_1.buttonL2.pressed(conveyer_reverse)
controller_1.buttonL2.released(conveyer_stop)

controller_1.buttonR1.pressed(lift_forward)
controller_1.buttonR1.released(lift_stop)

controller_1.buttonR2.pressed(lift_reverse)
controller_1.buttonR2.released(lift_stop)

controller_1.buttonY.pressed(threebar_forward)
controller_1.buttonY.released(threebar_stop)

controller_1.buttonB.pressed(threebar_reverse)
controller_1.buttonB.released(threebar_stop)

controller_1.buttonRight.pressed(spinner_forward)
controller_1.buttonRight.released(spinner_stop)

controller_1.buttonDown.pressed(spinner_reverse)
controller_1.buttonDown.released(spinner_stop)

drivetrain.set_drive_velocity(100,PERCENT)
drivetrain.set_stopping(COAST)

CONVEYER.set_velocity(75,PERCENT)
CONVEYER.set_stopping(COAST)

LIFT.set_velocity(100,PERCENT)
LIFT.set_stopping(BRAKE)

THREEBAR.set_velocity(100,PERCENT)
THREEBAR.set_stopping(BRAKE)

SPINNER.set_velocity(100,PERCENT)
SPINNER.set_stopping(BRAKE)

def autonomous():
drivetrain.set_drive_velocity(75,PERCENT)
drivetrain.set_turn_velocity(100,PERCENT)
CONVEYER.set_velocity(100,PERCENT)
LIFT.set_velocity(100,PERCENT)
THREEBAR.set_velocity(100,PERCENT)
SPINNER.set_velocity(100,PERCENT)
drivetrain.set_stopping(BRAKE)
CONVEYER.set_stopping(COAST)
LIFT.set_stopping(BRAKE)
THREEBAR.set_stopping(BRAKE)
SPINNER.set_stopping(BRAKE)
INERTIAL.calibrate()
LIFT.spin_for(FORWARD,DEGREES)
CONVEYER.spin_for(FORWARD,SECONDS)
LIFT.spin_for(REVERSE,DEGREES)
drivetrain.drive_for(REVERSE,INCHES)
drivetrain.turn_for(LEFT,90,DEGREES)
drivetrain.drive_for(FORWARD,INCHES)
drivetrain.turn_for(RIGHT,90,DEGREES)
drivetrain.drive_for(FORWARD,INCHES)
LIFT.spin_for(FORWARD,DEGREES)
CONVEYER.spin_for(FORWARD,SECONDS)
drivetrain.drive_for(REVERSE,INCHES)
LIFT.spin_for(REVERSE,DEGREES)
drivetrain.drive_for(REVERSE,INCHES)

I don’t have measurements in yet but I will soon

I’m not super wise in my coding skills, but I will say please put all code into code format by putting it in [~code] [/code] (without da squiggle) like this:

def conveyer_forward():
CONVEYER.spin(FORWARD)

def conveyer_reverse():
CONVEYER.spin(REVERSE)

def conveyer_stop():
CONVEYER.stop()

def lift_forward():
LIFT.spin(FORWARD)

def lift_reverse():
LIFT.spin(REVERSE)

def lift_stop():
LIFT.stop()

def threebar_forward():
THREEBAR.spin(FORWARD)

def threebar_reverse():
THREEBAR.spin(REVERSE)

def threebar_stop():
THREEBAR.stop()

def spinner_forward():
SPINNER.spin(FORWARD)

def spinner_reverse():
SPINNER.spin(REVERSE)

def spinner_stop():
SPINNER.stop()

controller_1.buttonL1.pressed(conveyer_forward)
controller_1.buttonL1.released(conveyer_stop)

controller_1.buttonL2.pressed(conveyer_reverse)
controller_1.buttonL2.released(conveyer_stop)

controller_1.buttonR1.pressed(lift_forward)
controller_1.buttonR1.released(lift_stop)

controller_1.buttonR2.pressed(lift_reverse)
controller_1.buttonR2.released(lift_stop)

controller_1.buttonY.pressed(threebar_forward)
controller_1.buttonY.released(threebar_stop)

controller_1.buttonB.pressed(threebar_reverse)
controller_1.buttonB.released(threebar_stop)

controller_1.buttonRight.pressed(spinner_forward)
controller_1.buttonRight.released(spinner_stop)

controller_1.buttonDown.pressed(spinner_reverse)
controller_1.buttonDown.released(spinner_stop)

drivetrain.set_drive_velocity(100,PERCENT)
drivetrain.set_stopping(COAST)

CONVEYER.set_velocity(75,PERCENT)
CONVEYER.set_stopping(COAST)

LIFT.set_velocity(100,PERCENT)
LIFT.set_stopping(BRAKE)

THREEBAR.set_velocity(100,PERCENT)
THREEBAR.set_stopping(BRAKE)

SPINNER.set_velocity(100,PERCENT)
SPINNER.set_stopping(BRAKE)

def autonomous():
drivetrain.set_drive_velocity(75,PERCENT)
drivetrain.set_turn_velocity(100,PERCENT)
CONVEYER.set_velocity(100,PERCENT)
LIFT.set_velocity(100,PERCENT)
THREEBAR.set_velocity(100,PERCENT)
SPINNER.set_velocity(100,PERCENT)
drivetrain.set_stopping(BRAKE)
CONVEYER.set_stopping(COAST)
LIFT.set_stopping(BRAKE)
THREEBAR.set_stopping(BRAKE)
SPINNER.set_stopping(BRAKE)
INERTIAL.calibrate()
LIFT.spin_for(FORWARD,DEGREES)
CONVEYER.spin_for(FORWARD,SECONDS)
LIFT.spin_for(REVERSE,DEGREES)
drivetrain.drive_for(REVERSE,INCHES)
drivetrain.turn_for(LEFT,90,DEGREES)
drivetrain.drive_for(FORWARD,INCHES)
drivetrain.turn_for(RIGHT,90,DEGREES)
drivetrain.drive_for(FORWARD,INCHES)
LIFT.spin_for(FORWARD,DEGREES)
CONVEYER.spin_for(FORWARD,SECONDS)
drivetrain.drive_for(REVERSE,INCHES)
LIFT.spin_for(REVERSE,DEGREES)
drivetrain.drive_for(REVERSE,INCHES)

Much better. Also could you maybe specify why exactly you created this post? Is it not working? If so, please specify.
Thanks.

1 Like

I’m pretty sure indents disappear when you copy and paste into the forum or something, but make sure all the code within each function is indented properly.

1 Like

Indents are proprer I didn’t take the time to put them in