Pressure switch

Were trying to use a low pressure switch for our pneumatics. My question is do I need to program it so it’ll work? If so, how?

yes. you’ll need two things

  1. a pressure switch on the compressor that will return true when the pressure is above n psi and false when it is below n psi. (ask your electrical team to setup n)

  2. a compressor hooked up to the sidecar (or a relay hooked up to the compressor)

if(pressure switch == true){
set compressor = false
}else{
set compressor = true
}

so basically what it will do is that if the pressure switch is returning true (meaning that its above n psi) than turn the compressor off but if its returning false (below n psi) it will turn it on to turn up the psi.

you also will want to have this running not only in teleopPeriodic but also autonomosPeriodic and disabledPeriodic

You can also use the Compressor object in WPILib. The way it works is to start a background thread that polls the pressure switch periodically and turns the compressor on and off by itself. So you don’t need loops and don’t need to look at the switch or operate the Spike relay that controls the compressor.

To use it see this page for a C++ example, but the Java version is almost the same:

http://wpilib.screenstepslive.com/s/3120/m/7912/l/85779-operating-a-compressor-for-pneumatics

Brad