Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into main
  • Loading branch information
Zoomer234 committed Jan 6, 2022
2 parents 8962d72 + 1cced4a commit cd860c2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"**/.project": true,
"**/.factorypath": true,
"**/*~": true

}
}
2 changes: 2 additions & 0 deletions quotes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"beep bop boop I make lines"
-Evan Kuykendall, 2021
2 changes: 1 addition & 1 deletion src/main/java/com/spartronics4915/frc/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
*/
public final class Constants
{
public static final int kTestMotorId = 0;
public static final int kTestMotorId = 1;
}
3 changes: 3 additions & 0 deletions src/main/java/com/spartronics4915/frc/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import com.spartronics4915.lib.subsystems.SpartronicsSubsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class Robot extends TimedRobot
{
Expand Down Expand Up @@ -38,6 +40,7 @@ public void robotPeriodic()
// periodic() methods.
// This must be called from the robot's periodic block in order for
// anything in the command-based framework to work.
SmartDashboard.putString("robotPeriodic","Entered");
CommandScheduler.getInstance().run();
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/spartronics4915/frc/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import com.spartronics4915.frc.commands.ExampleCommand;
import com.spartronics4915.frc.subsystems.ExampleSubsystem;
import com.spartronics4915.lib.subsystems.SpartronicsSubsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;

// Troy Edwards was here
//

/**
* This class is where the bulk of the robot should be declared.
Expand All @@ -26,10 +28,11 @@ public class RobotContainer
public RobotContainer()
{
// ...and constructed here.
mExampleSubsystem = new ExampleSubsystem();
mExampleSubsystem = ExampleSubsystem.getInstance();
mAutoCommand = new ExampleCommand(mExampleSubsystem);

configureButtonBindings();
SmartDashboard.putString("Container","Completed");
}

/** Use this method to define your button ==> command mappings. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ExampleCommand(ExampleSubsystem subsystem)
// Called when the command is initially scheduled.
@Override
public void initialize() {
mExampleSubsystem.startTestMotor(1.0);
mExampleSubsystem.startTestMotor(0.3);
}

// Called every time the scheduler runs while the command is scheduled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
import com.spartronics4915.frc.Constants;
import com.spartronics4915.lib.subsystems.SpartronicsSubsystem;

import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import com.revrobotics.CANError;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMax.IdleMode;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;

/**
* We're not using Talon any more
* import edu.wpi.first.wpilibj.Talon;
* /
/**
* Detailed description of ExampleSubsystem.
Expand All @@ -12,15 +22,15 @@ public class ExampleSubsystem extends SpartronicsSubsystem
{
private static ExampleSubsystem sInstance = null;
// The subsystem's hardware is defined here...
private static Talon mTestMotor;
private static CANSparkMax mTestMotor;

/** Creates a new ExampleSubsystem. */
public ExampleSubsystem()
{
boolean success = true;
try
{
mTestMotor = new Talon(Constants.kTestMotorId);
mTestMotor = new CANSparkMax(Constants.kTestMotorId,MotorType.kBrushless);
}
catch (Exception exception)
{
Expand All @@ -30,7 +40,7 @@ public ExampleSubsystem()
logInitialized(success);
}

public static ExampleSubsystem getsInstance()
public static ExampleSubsystem getInstance()
{
if (sInstance == null) {
sInstance = new ExampleSubsystem();
Expand All @@ -41,16 +51,21 @@ public static ExampleSubsystem getsInstance()
// Subsystem methods - actions the robot can take - should be placed here.

public void startTestMotor(double speed) {
SmartDashboard.putString("Motor","Starting motor");
mTestMotor.set(speed);
SmartDashboard.putNumber("Speed",mTestMotor.get());
}

public void stopTestMotor() {
SmartDashboard.putString("Motor","Stopping motor");
mTestMotor.set(0.0);
}

/** This method will be called once per scheduler run. */
@Override
public void periodic() {}
public void periodic() {
SmartDashboard.putString("Periodic","Starting");
}

/** This method will be called once per scheduler run during simulation. */
@Override
Expand Down

0 comments on commit cd860c2

Please sign in to comment.