Re: Program not working with competition correctly
There are a couple of main issues that I am seeing with the code.
First, make sure to set up the motors in the Motors and Sensors Setup window to match what type of motor you are using on each port. This will ensure that the correct motors types are being used on each port and is a good practice to follow.
Also, which mode are you running when you have the competition control switch plugged into the robot and enabled? You've manually reversed three of the motors in the User Control section of the code, but have not reversed them in the Autonomous portion of your code:
This is another good reason to use the Motors and Sensors Setup window for configuring your robot, as it has a 'Reversed' checkbox for that can be used to reverse the motors for the entire program.
One more thing to note:
The closing brace for this 'else' statement is not found until the very end of the program; this means that the solenoid control will only be checked when buttons 5U or 5D are not pressed. I'm not sure if this is intentional or not, but wanted to let you know just in case it isn't.
Check out our Blog
! And our Facebook page
Need help? Take a look at our updated help documentation
and the ROBOTC Forums.