Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.subsystems.MotorBoardSubsystem;
import frc.robot.subsystems.ColorSensor;

/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/frc/robot/subsystems/ColorSensor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import com.revrobotics.ColorSensorV3;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.util.Color;

public class sensorTest {
private ColorSensorV3 testSensor;

public ColorSensor {
colorSensor = new ColorSensorV3(I2C.Port.kOnboard);
}

public void colorOuput {
SmartDashboard.putNumber("Red", colorSensor.getRed());
SmartDashboard.putNumber("Green", colorSensor.getGreen());
SmartDashboard.putNumber("Blue", colorSensor.getBlue());
SmartDashboard.putNumber("Color", colorSensor.getColor());
}

public Color getColor() {
return colorSensor.getColor();
}

public double getIR(){
return colorSensor.getIR();
}

@Override
public void periodic(){
updateValues();
}
}