Compare commits
	
		
			2 Commits
		
	
	
		
			a45f27eb7f
			...
			908c5d0b96
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					908c5d0b96 | ||
| 
						 | 
					46a71c5fba | 
							
								
								
									
										48
									
								
								src/main/java/frc/robot/Commands/LEDactive.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/main/java/frc/robot/Commands/LEDactive.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
// Copyright (c) FIRST and other WPILib contributors.
 | 
			
		||||
// Open Source Software; you can modify and/or share it under the terms of
 | 
			
		||||
// the WPILib BSD license file in the root directory of this project.
 | 
			
		||||
 | 
			
		||||
package frc.robot.Commands;
 | 
			
		||||
 | 
			
		||||
import edu.wpi.first.wpilibj2.command.Command;
 | 
			
		||||
import frc.robot.Subsystems.Accumulateur;
 | 
			
		||||
import frc.robot.Subsystems.LED;
 | 
			
		||||
 | 
			
		||||
public class LEDactive extends Command {
 | 
			
		||||
  private Accumulateur accumulateur;
 | 
			
		||||
  private LED led;
 | 
			
		||||
  /** Creates a new LEDactive. */
 | 
			
		||||
  public LEDactive(Accumulateur accumulateur, LED led) {
 | 
			
		||||
    this.accumulateur = accumulateur;
 | 
			
		||||
    this.led = led;
 | 
			
		||||
    addRequirements(accumulateur,led);
 | 
			
		||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Called when the command is initially scheduled.
 | 
			
		||||
  @Override
 | 
			
		||||
  public void initialize() {}
 | 
			
		||||
 | 
			
		||||
  // Called every time the scheduler runs while the command is scheduled.
 | 
			
		||||
  @Override
 | 
			
		||||
  public void execute() {
 | 
			
		||||
    if(accumulateur.photocell())
 | 
			
		||||
    led.led(0, 255, 0);
 | 
			
		||||
    else{
 | 
			
		||||
      led.led(25, 25, 100);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  // Called once the command ends or is interrupted.
 | 
			
		||||
  @Override
 | 
			
		||||
  public void end(boolean interrupted) {
 | 
			
		||||
    led.led(25, 25, 100);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Returns true when the command should end.
 | 
			
		||||
  @Override
 | 
			
		||||
  public boolean isFinished() {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								src/main/java/frc/robot/Subsystems/LED.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/main/java/frc/robot/Subsystems/LED.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
// Copyright (c) FIRST and other WPILib contributors.
 | 
			
		||||
// Open Source Software; you can modify and/or share it under the terms of
 | 
			
		||||
// the WPILib BSD license file in the root directory of this project.
 | 
			
		||||
 | 
			
		||||
package frc.robot.Subsystems;
 | 
			
		||||
 | 
			
		||||
import com.ctre.phoenix.led.CANdle;
 | 
			
		||||
 | 
			
		||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
			
		||||
 | 
			
		||||
public class LED extends SubsystemBase {
 | 
			
		||||
  /** Creates a new LED. */
 | 
			
		||||
  public LED() {}
 | 
			
		||||
  CANdle led = new CANdle(0);
 | 
			
		||||
  public void led(int R, int G, int B){
 | 
			
		||||
    led.setLEDs(R, G, B);
 | 
			
		||||
  }
 | 
			
		||||
  @Override
 | 
			
		||||
  public void periodic() {
 | 
			
		||||
    // This method will be called once per scheduler run
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user