Pneumatics Programming Help

Hi, I’m new to programming with Java. I’m using Netbeans command based robot. I currently have the drive and buttons working but I don’t know how to do the pneumatics.

How do you program the compressor to start and stop on its own?

How do you tell the solenoids to fire?

I think I need a subsystem for pneumatics that controls all of this, and then specific commands to fire those solenoids. Any help would be much appreciated.

Luckily you do not have to do anything for the compressor except create it and start it. We did this in RobotMap in the init() method.

To fire solenoids you do a set(true) and set(false) to then them on and off.

I was also new to java this year so I am glad to finally be on the opposite end of the question for once. All you need to do is put your compressor inside of whatever class you have extending iterative robot. Inside the robotInit method put in compressor.start(). Then leave the shutting off part to your pressure switch. Now make a subsystem for the piston you are using (for me I call ours ShootPiston). Inside the subsystem make two Solenoid objects (one for extend and one for retract). Make three methods (extend, retract, stop) and set the solenoid objects using their set method to true or false depending on what each one is doing. Then make commands to extend and retract and in there call each method respectively. If you need more help with this or if I wasn’t clear let me know.

Alright. I think I understand everything you are saying, but when I put compressor.start() in robotInit, it gave me an error like it can’t find compressor. Why is this?

And I’m pretty sure I understand the solenoid part. Sounds simple enough. If you get bored, could you post me a link or a part of this code please just in case. Better safe than sorry.

Thanks again for your help.

Never mind. I got it all figured out. Thanks again for your help. It really is pretty easy. I just didn’t know where to put the compressor.