-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from prosa100/20_compressorSubsystem
Added a compressor subsystem (#20): controls both solenoids and compressor
- Loading branch information
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
frc2022_2014/src/org/usfirst/frc2022_2014/subsystems/CompressorSubsystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package org.usfirst.frc2022_2014.subsystems; | ||
|
||
import edu.wpi.first.wpilibj.Compressor; | ||
import edu.wpi.first.wpilibj.DoubleSolenoid; | ||
import edu.wpi.first.wpilibj.Relay; | ||
import edu.wpi.first.wpilibj.Solenoid; | ||
import edu.wpi.first.wpilibj.command.Subsystem; | ||
|
||
/** | ||
* | ||
* @author Michael | ||
*/ | ||
public class CompressorSubsystem extends Subsystem { | ||
|
||
private Compressor compressor; | ||
private DoubleSolenoid dsol; | ||
|
||
public CompressorSubsystem(int sol1Port, int sol2Port, int compSwitchChannel, int compRelayChannel){ | ||
compressor = new Compressor(compSwitchChannel, compRelayChannel); | ||
dsol = new DoubleSolenoid(sol1Port, sol2Port); | ||
} | ||
|
||
public void start(){ | ||
compressor.start(); | ||
dsol.set(DoubleSolenoid.Value.kOff); | ||
} | ||
|
||
public void stop(){ | ||
dsol.set(DoubleSolenoid.Value.kOff); | ||
compressor.stop(); | ||
} | ||
|
||
public void closeSolenoid(){ | ||
dsol.set(DoubleSolenoid.Value.kOff); | ||
} | ||
|
||
public void forwardSolenoid(){ | ||
dsol.set(DoubleSolenoid.Value.kForward); | ||
} | ||
|
||
public void backwardSolenoid(){ | ||
dsol.set(DoubleSolenoid.Value.kReverse); | ||
} | ||
|
||
public void initDefaultCommand() { | ||
|
||
} | ||
} |