leds pince
This commit is contained in:
		| @@ -42,14 +42,14 @@ public class RobotContainer { | |||||||
|     NamedCommands.registerCommand("L3", new L3(elevateur, pince)); |     NamedCommands.registerCommand("L3", new L3(elevateur, pince)); | ||||||
|     NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie)); |     NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie)); | ||||||
|     NamedCommands.registerCommand("CoralInspire", new CoralInspire(pince,bougie)); |     NamedCommands.registerCommand("CoralInspire", new CoralInspire(pince,bougie)); | ||||||
|     NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince)); |     NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie)); | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private void configureBindings() { |   private void configureBindings() { | ||||||
|     // manette1 |     // manette1 | ||||||
|     manette1.a().whileTrue(new AlgueExpire(pince)); |     manette1.a().whileTrue(new AlgueExpire(pince,bougie)); | ||||||
|     manette1.b().whileTrue(new CoralAlgueInspire(pince)); |     manette1.b().whileTrue(new CoralAlgueInspire(pince,bougie)); | ||||||
|     manette1.x().whileTrue(new CoralInspire(pince,bougie)); |     manette1.x().whileTrue(new CoralInspire(pince,bougie)); | ||||||
|     manette1.y().whileTrue(new CoralExpire(pince,bougie)); |     manette1.y().whileTrue(new CoralExpire(pince,bougie)); | ||||||
|     manette1.povUp().whileTrue(new L4(elevateur, pince)); |     manette1.povUp().whileTrue(new L4(elevateur, pince)); | ||||||
|   | |||||||
| @@ -5,15 +5,18 @@ | |||||||
| package frc.robot.commands; | package frc.robot.commands; | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
|  | import frc.robot.subsystems.Bougie; | ||||||
| import frc.robot.subsystems.Pince; | import frc.robot.subsystems.Pince; | ||||||
|  |  | ||||||
| /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||||||
| public class AlgueExpire extends Command { | public class AlgueExpire extends Command { | ||||||
|   private Pince pince; |   private Pince pince; | ||||||
|  |   private Bougie bougie; | ||||||
|   /** Creates a new CoralAlgue. */ |   /** Creates a new CoralAlgue. */ | ||||||
|   public AlgueExpire(Pince pince) { |   public AlgueExpire(Pince pince,Bougie bougie) { | ||||||
|     this.pince = pince; |     this.pince = pince; | ||||||
|     addRequirements(pince); |     this.bougie = bougie; | ||||||
|  |     addRequirements(pince,bougie); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -24,7 +27,14 @@ public class AlgueExpire extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     pince.aspirealgue(0.5); |     if(pince.emperagealgue()>8){ | ||||||
|  |       pince.aspirealgue(0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.aspirealgue(0.5); | ||||||
|  |       bougie.Jaune(); | ||||||
|  |     } | ||||||
|  |      | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   | |||||||
| @@ -5,15 +5,18 @@ | |||||||
| package frc.robot.commands; | package frc.robot.commands; | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
|  | import frc.robot.subsystems.Bougie; | ||||||
| import frc.robot.subsystems.Pince; | import frc.robot.subsystems.Pince; | ||||||
|  |  | ||||||
| /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||||||
| public class CoralAlgueInspire extends Command { | public class CoralAlgueInspire extends Command { | ||||||
|   private Pince pince; |   private Pince pince; | ||||||
|  |   private Bougie bougie; | ||||||
|   /** Creates a new CoralAlgue. */ |   /** Creates a new CoralAlgue. */ | ||||||
|   public CoralAlgueInspire(Pince pince) { |   public CoralAlgueInspire(Pince pince, Bougie bougie) { | ||||||
|     this.pince = pince; |     this.pince = pince; | ||||||
|     addRequirements(pince); |     this.bougie = bougie; | ||||||
|  |     addRequirements(pince,bougie); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -27,6 +30,7 @@ public class CoralAlgueInspire extends Command { | |||||||
|     pince.aspirecoral(-.5); |     pince.aspirecoral(-.5); | ||||||
|     if(pince.emperagealgue()>8){ |     if(pince.emperagealgue()>8){ | ||||||
|       pince.aspirealgue(0); |       pince.aspirealgue(0); | ||||||
|  |       bougie.Bleu(); | ||||||
|      }  |      }  | ||||||
|      else{ |      else{ | ||||||
|       pince.aspirealgue(0.5); |       pince.aspirealgue(0.5); | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ public class CoralExpire extends Command { | |||||||
|    } |    } | ||||||
|    else{ |    else{ | ||||||
|     pince.aspirecoral(-.5); |     pince.aspirecoral(-.5); | ||||||
|     bougie.Rouge();} |     bougie.Jaune();} | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   | |||||||
| @@ -27,7 +27,6 @@ public class CoralInspire extends Command { | |||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     if(pince.emperagecoral()>8){ |     if(pince.emperagecoral()>8){ | ||||||
|     bougie.Vert(); |  | ||||||
|     pince.aspirecoral(0);   |     pince.aspirecoral(0);   | ||||||
|     } |     } | ||||||
|     else{ |     else{ | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| package frc.robot.commands; | package frc.robot.commands; | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
|  | import frc.robot.subsystems.Bougie; | ||||||
| import frc.robot.subsystems.Elevateur; | import frc.robot.subsystems.Elevateur; | ||||||
| import frc.robot.subsystems.Pince; | import frc.robot.subsystems.Pince; | ||||||
|  |  | ||||||
| @@ -38,6 +39,7 @@ public class L2 extends Command { | |||||||
|     } |     } | ||||||
|     if(pince.encodeurpivot()>=500 && pince.encodeurpivot()<=510){ |     if(pince.encodeurpivot()>=500 && pince.encodeurpivot()<=510){ | ||||||
|       pince.pivote(0); |       pince.pivote(0); | ||||||
|  |       | ||||||
|     } |     } | ||||||
|     else if(pince.encodeurpivot()>=510){ |     else if(pince.encodeurpivot()>=510){ | ||||||
|       pince.pivote(-0.3); |       pince.pivote(-0.3); | ||||||
| @@ -45,6 +47,7 @@ public class L2 extends Command { | |||||||
|     else{ |     else{ | ||||||
|       pince.pivote(0.3); |       pince.pivote(0.3); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| package frc.robot.commands; | package frc.robot.commands; | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
|  | import frc.robot.subsystems.Bougie; | ||||||
| import frc.robot.subsystems.Elevateur; | import frc.robot.subsystems.Elevateur; | ||||||
| import frc.robot.subsystems.Pince; | import frc.robot.subsystems.Pince; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| package frc.robot.commands; | package frc.robot.commands; | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
|  | import frc.robot.subsystems.Bougie; | ||||||
| import frc.robot.subsystems.Elevateur; | import frc.robot.subsystems.Elevateur; | ||||||
| import frc.robot.subsystems.Pince; | import frc.robot.subsystems.Pince; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,14 +20,29 @@ public class Bougie extends SubsystemBase { | |||||||
|     candle.configAllSettings(config); |     candle.configAllSettings(config); | ||||||
|   } |   } | ||||||
|   public void Rouge() { |   public void Rouge() { | ||||||
|    candle.setLEDs(255, 0, 0); |    candle.setLEDs(255, 0, 0,0,8,8); | ||||||
|  |    candle.setLEDs(255, 0, 0,0,24,8); | ||||||
|  |    candle.setLEDs(255, 0, 0,0,40,8); | ||||||
|  |    candle.setLEDs(255, 0, 0,0,56,8); | ||||||
|   } |   } | ||||||
|   public void Vert() { |   public void Vert() { | ||||||
|    candle.setLEDs(0, 255, 0); |    candle.setLEDs(0, 255, 0,0,8,8); | ||||||
|  |    candle.setLEDs(0, 255, 0,0,24,8); | ||||||
|  |    candle.setLEDs(0, 255, 0,0,40,8); | ||||||
|  |    candle.setLEDs(0, 255, 0,0,56,8); | ||||||
|   } |   } | ||||||
|   public void Bleu() { |   public void Bleu() { | ||||||
|    candle.setLEDs(0, 0, 255); |     candle.setLEDs(0, 0, 255,0,16,8); | ||||||
|  |     candle.setLEDs(0, 0, 255,0,32,8); | ||||||
|  |     candle.setLEDs(0, 0, 255,0,48,8); | ||||||
|  |     candle.setLEDs(0, 0, 255,0,64,8); | ||||||
|   } |   } | ||||||
|  |    public void Jaune() { | ||||||
|  |    candle.setLEDs(255, 215, 0,0,16,8); | ||||||
|  |    candle.setLEDs(255, 215, 0,0,32,8); | ||||||
|  |    candle.setLEDs(255, 215, 0,0,48,8); | ||||||
|  |    candle.setLEDs(255, 215, 0,0,64,8); | ||||||
|  |    } | ||||||
|   public void RainBow(){candle.animate(rainbowAnim);} |   public void RainBow(){candle.animate(rainbowAnim);} | ||||||
|   public void RainBowStop(){candle.animate(null);} |   public void RainBowStop(){candle.animate(null);} | ||||||
|   @Override |   @Override | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user