Button 1 on Joystick 0 not available

I have some students working on a trainer module, and they are trying to learn the robot builder. When the create their code and load it to the Rio the driver station tells them that button 1 on Joystick 0 is unavailable. When we open the joystick port on the driver station we can see that button 1 activates when pushed, and that the joysticks is in port 0. Anyone had this issue before? Any ideas?

Java and VS Code based? I didn’t see this error ever with LabView but have started to see it with VS Code and Java. Not having the joystick plugged in before you start trying to connect to the robot seemed to be the main cause for me.

Yes, we are using Java. We have tried multiple controllers, and have plugged and unplugged them multiple times, reloading the code each time.

Now, we have tried to load a known working code and it still will not work. The motor does not turn on when the button is pressed, but we didn’t get the button error that we had before.

Post your code and a screenshot of the driver station screen, showing the controller in and the button pressed. This will be more helpful for troubleshooting.

Is it a drive motor or something with any type of load at all? I tested basic “move the robot with a button” at the end of last week and something similar may be happening to you. I thought it wasn’t working, but the actual problem was two fold.

The first issue is the method I was using, which was whenPressed(). I really intended to be testing whileHeld(). The code I had put in place would stop all movement of the robot when finished and it killed all movement after I pressed and released the button.

The second issue was I sent the motor a value of merely .1. This wasn’t even enough to break the friction holding the machine in place. In the end I used .3 and that at least got things moving. I’d suggest putting in a variable you can edit on the shuffleboard so you can play around with the value and not have to send code across for every change.