Quote:
Originally Posted by axton900
The issue that we are facing with the idea of just using a spike relay is the fact that the compressor class in wpilib only seems to be accepting the pcm as a parameter.
Could one of the teams who was able to use a relay share the code that they used for this situation?
Thanks in advance!
|
Older default code (2014 and before) would have some basic examples, though it should be pretty easy to program yourself.
There should be a way to read the pressure sensors state from the PCM in code, and if you have that, then all you have to do is use the output of the pressure state to toggle the spike on or off. The pressure sensor is a switch that activates at ~120psi and deactivates at ~ 100-110psi, so simply using it as a Boolean to toggle the compressor state should make it operate the same as a PCM controlled compressor would.
You can query the pressure switch and compressor status from the PCM and simply mimic the state of the PCM controlled compressor with the code on the bottom half of this page:
https://wpilib.screenstepslive.com/s...anual-id=13810
The second compressor, for the purposes of code, isn't a compressor, it's a Spike-controlled motor. Just make sure that the spike turns on and off at the appropriate times via the methods mentioned above.