So I made this simple code I made using WPI’s screensteps on DoubleSolenoid and I put it in Robot.java. However, when I enabled the robot, the compressor and the PCM already gathering air and the piston comes out immediately before I even pressed the button.
Robot.java
I’m using Command based.
Instead of using koff, try using kreverse… if you are trying to test it moving back and forth
This is expected - simply declaring the solenoid in code will start the compressor automatically.
Okay, I’ll do but when I enable Teleop, the piston already comes out before I even pressed the button.
CIM
February 8, 2019, 9:54pm
5
Do kReverse instead of kOff in your else statement.
jdao
February 8, 2019, 9:57pm
6
You can solve this multiple ways:
Swap the plumbing on the Piston. It sounds like your high/low pipes are reversed.
Use kReverse in your if() statement and kForward in your else statement. Not preferred, but it should work.
you can also initialize to be in desired position by declaring it in the robotinit. then you can make sure that it always starts on the same position