I was wondering if anyone could help me with turning on the compressor. I am new to coding and my team is using pneumatics. We are writing in jave timed based. Thank you.
The compressor should turn on automatically if there is less than 120 psi. You can turn this off via code, but this doesn’t seem to be the problem.
Either way, there is a Compressor class in WPILib, you pass the CAN ID of the PCM to the constructor (it has a zero-arg overload that passes 0 as the ID), and you use setClosedLoopState to turn off/on the loop that turns on the compressor if there is less than 120 psi. Last I checked, that sums up everything you can do with the compressor via code.
Well when I do turn on the robot it does not turn on the compressor, is there a line of code to turn it on in robotinit, I have it defined as Compressor comp = new Compressor(0);. but I do not know where to use this.
Without any code references to the compressor, does it turn on when you turn on the robot? If not, it is probably wired incorrectly and you will not pass Inspection.
It is a problem with the pcm, it is yellow flashing lights, electrical was yelling at me for a bit, thank god its not my fault.
Isn’t it supposed to be the other way around?
I forget the actual line but it should be something along the “comp.closedloopcontrol(true)” to make the compressor run until 120psi. Also im a c++ programmer… might be slightly different
That’s the default behavior as of sometime in the last couple years. As soon as you instantiate a
DoubleSolenoid) object, the PCM will enter closed-loop control mode for the compressor.