Skip to content

Commit

Permalink
Merge branch 'master' into DriveMotor
Browse files Browse the repository at this point in the history
Conflicts:
	src/OI.cpp
  • Loading branch information
bit-101010 committed Dec 14, 2017
2 parents c99eac1 + 0a43bfe commit 18b5cc8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Commands/StickOfJoy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "StickOfJoy.h"

StickOfJoy::StickOfJoy() {
Requires(Robot::driveMotor.get());
// Use Requires() here to declare subsystem dependencies
// eg. Requires(Robot::chassis.get());
}

// Called just before this Command runs the first time
void StickOfJoy::Initialize() {


}

// Called repeatedly when this Command is scheduled to run
void StickOfJoy::Execute() {
Robot::driveMotor->SetLeftMotor(Robot::oi->getJoystick1()->GetY());
Robot::driveMotor->SetRightMotor(Robot::oi->getJoystick1()->GetY());
}

// Make this return true when this Command no longer needs to run execute()
bool StickOfJoy::IsFinished() {
return false;
}

// Called once after isFinished returns true
void StickOfJoy::End() {

}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void StickOfJoy::Interrupted() {
Robot::driveMotor->StopLeftMotor();
Robot::driveMotor->StopRightMotor();
}
16 changes: 16 additions & 0 deletions src/Commands/StickOfJoy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef StickOfJoy_H
#define StickOfJoy_H

#include "../CommandBase.h"

class StickOfJoy : public CommandBase {
public:
StickOfJoy();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};

#endif // StickOfJoy_H
2 changes: 2 additions & 0 deletions src/OI.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class OI {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PROTOTYPES

std::shared_ptr<Joystick> getJoystick1();
std::shared_ptr<Joystick> getY();

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PROTOTYPES
};

Expand Down

0 comments on commit 18b5cc8

Please sign in to comment.