protected override void Main() { while (true) { DriveTrain.TankDrive(-DriveStick_Left.GetRawAxis(1), -DriveStick_Right.GetRawAxis(1)); if ((DriveStick_Left.GetRawAxis(1) < -0.1 || DriveStick_Right.GetRawAxis(1) < -0.1) && !Custom_Board.GetRawButton(4)) { Intake1.Set(-1); Intake2.Set(-1); } else { Intake1.Set(0); Intake2.Set(0); } if (Custom_Board.GetRawButton(4)) { Shooter.Set(.9); Agitator.Set(1); } else { Shooter.Set(0); Agitator.Set(0); } if (DriveStick_Left.GetRawButton(1) || DriveStick_Right.GetRawButton(1)) { if (flag) { Shifters.Set(!Shifters.Get()); flag = false; } } else { flag = true; } if (DriveStick_Left.GetRawAxis(2) > 0.1) { PTO.Set(true); } else { PTO.Set(false); } Shooter_Pivot.Set(.5 * Custom_Board.GetRawAxis(4)); Snooze(10); } }
public static DriveTrainKind GetDriveTrainKind(this DriveTrain value) { var fieldInfo = typeof(DriveTrain).GetField(value.ToString()); var attributes = fieldInfo.GetCustomAttributes(typeof(DriveTrainKindAttribute), false) .Cast <DriveTrainKindAttribute>(); return(attributes.Select(a => a.Kind).SingleOrDefault()); }
public Car(string make, string modle, int doors, string color, DriveTrain driveTrainType) { this.make = make; this.modle = modle; this.doors = doors; this.color = color; DriveTrain driveTrain = new DriveTrain(); driveTrain = driveTrainType; }
static void Main(string[] args) { DriveTrain drivetrain = new DriveTrain(); drivetrain.Uses = "Disele"; drivetrain.Liters = 53; Car car = new Car("Bmw", "M3", 5); ATV atv = new ATV("Bazoka", "Z300", 1); Motorcycle motorcycle = new Motorcycle("Kawasaki", "KB300", 3); Bike bike = new Bike("Biltema", "Standard", 1); Console.WriteLine("I have a " + car.name + ", " + car.model + " with " + car.GetGears() + " Gears " + drivetrain); Console.WriteLine("I have a " + atv.name + ", " + atv.model + " with " + atv.GetGears() + " Gears"); Console.WriteLine("I have a " + motorcycle.name + ", " + motorcycle.model + " with " + motorcycle.GetGears() + " Gears"); Console.WriteLine("I have a " + bike.name + ", " + bike.model + " with " + bike.GetGears() + " Gears"); Console.ReadLine(); }
protected override void Main() { while (true) { if (Custom_Board.GetRawAxis(2) > 0.1) { Intake1.Set(-1); Intake2.Set(1); } else if (DriveStick_Right.GetRawButton(3) || Custom_Board.GetRawAxis(3) > 0.1) { Intake1.Set(1); Intake2.Set(-1); } else { Intake1.Set(0); Intake2.Set(0); } if (Custom_Board.GetRawButton(3)) { if (started) { if ((Environment.TickCount - time) > 1000) { Agitator.Set(1); IntakeSecondStage.Set(-1); } } else { time = Environment.TickCount; started = true; Shooter.Set(.95); } } else if (Custom_Board.GetRawButton(2)) { if (started) { if ((Environment.TickCount - time) > 1000) { Agitator.Set(-1); IntakeSecondStage.Set(-1); } } else { time = Environment.TickCount; started = true; Shooter.Set(.95); } } else { Shooter.Set(0); Agitator.Set(0); IntakeSecondStage.Set(0); started = false; } if (DriveStick_Left.GetRawButton(1) || DriveStick_Right.GetRawButton(1)) { if (toggleshift) { Shifters.Set(!Shifters.Get()); toggleshift = false; } } else { toggleshift = true; } if (DriveStick_Left.GetRawButton(6) && DriveStick_Right.GetRawButton(11)) { if (togglepto) { PTO.Set(!PTO.Get()); togglepto = false; } } else { togglepto = true; } if (PTO.Get()) { if (DriveStick_Right.GetRawAxis(1) >= 0) { DriveTrain.StopMotor(); } else { DriveTrain.Move(DriveStick_Right.GetRawAxis(1), DriveStick_Right.GetRawAxis(1)); } } else { DriveTrain.Move(-DriveStick_Left.GetRawAxis(1), -DriveStick_Right.GetRawAxis(1)); } if (Custom_Board.GetRawButton(4)) { GearSlot.Set(true); } else { GearSlot.Set(false); } //if (DriveStick_Left.GetRawAxis(2) > 0.1) PTO.Set(true); //else PTO.Set(false); // Set the shooter pivot to a specific point based on the joysticks. //TurntableController.Controller.Setpoint = ((encoderTicks + Custom_Board.GetRawAxis(4)) / 2); Shooter_Pivot.Set(.5 * Custom_Board.GetRawAxis(4)); Snooze(10); } }