My autonomous code isn't working.

I want the “Motor for actuator” to go down for 10 seconds. Then the “Swing” to go foward for 5 seconds. Finally, the “Motor for actuator” to go up for 15 seconds.

I built and deloyed the code. When I pressed button 11 on joystick 2, nothing happened. Is my code correct?

Thank you.







The first issue I see is, joysticks are not read in Autonomous mode. By placing your code in a case structure that is dependent on that input, you are preventing it from running.

I thought the initial value was read when autonomous started, but it couldn’t be changed during autonomous. As it stands here the false case should be running. If the button was being pressed as autonomous started it would run the true case. Since you can’t touch the control as autonomous starts you’d have to tape a rock to the button or something if you wanted the true case to run.

Below is a quote from a comment within the autonomous default project.

Note that all Driver Station inputs are automatically latched and will not change once auto begins.

The code in the second picture is not needed, and the case structure and the vi’s connected to it should be removed. All you need for autonomous is the while loops.

You are correct. Although, I believe the OP was stating that the button was pressed after Autonomous was started.

I removed the joystick, left the case structure, and enclosed everything in a while loop.
I’m sure that this is the wrong way to go about this.
Can you please explain how to fix this code in simple terms?

Thank you!

So then remove the case structure and add a while loop?
Why is a case structure inappropraite for my objective?

The code within the case structure is correct. The case structure is inappropriate for autonomous because it requires you to manual change the value. Sorry, i mixed up my structures, you were correcting having the sequence loop, while loops are for autonomous also, but i have no experience with them. Keep your sequence, and remove the case structures.

Makes sense.
Thank you for clearing that up :slight_smile: