Button Pressed Issues

i have coded this so that the catapult will move down to a position before it slips automatically when a button is pressed and another button to shoot it. however it will not run, so what am i doing wrong?
Screenshot 2022-10-17 130535

Can I see the functions the callbacks are calling?

Screenshot 2022-10-17 130934

I think your problem might be in the wait(50,seconds) as it is blocking pre auton from running. I would not recommend using a wait and instead use brain.timer .

i deleted that part, same issue

Try putting a print statement or making the controller rumble inside the callback to check whether or not the callback is working.

It might be because your code is in your main() instead of your usercontrol(). Your code also should be in a while(true) loop so it can constantly check if the button has been pressed.
Edit: See DougMoyers’s reply below.

Try removing Catapult.stop() - it is redundant, as spinToPosition stops when complete. This would also let you convert the spin to non-blocking by adding false at the end so you can continue driving while the catapult is moving into position.


Pressed is intended to be used as a callback function as the OP has done. You are thinking of Pressing


I wasn’t aware of that, I’ll keep that in mind.

thank you so much for all of your suggestions! I ended up using another method to doing this, but @DougMoyers tip will be useful also for this!

could you provide an example of this, I have never used the brain timer fuction before??

This is inside of a while true loop

    if (Brain.timer(sec) == 15) 

You can also use Brain.timer.reset();

i have tried that, still nothing is happening.