2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00
dent/Subsystems/Elevator.cpp

39 lines
930 B
C++
Raw Normal View History

2015-01-16 19:29:55 -05:00
#include "Elevator.h"
#include "../RobotMap.h"
2015-02-07 13:08:24 -05:00
Elevator::Elevator(){
2015-02-02 19:56:27 -05:00
motor=new CANTalon(ELEVATOR_CAN);
elevatorEncoder=new Encoder(ELEVATOR_ENCODERA,ELEVATOR_ENCODERB,false);
elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO);
elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO);
// Checks if the elevator is drifting
useEncoder=false;
2015-01-16 19:29:55 -05:00
}
2015-01-17 12:21:16 -05:00
void Elevator::InitDefaultCommand(){
2015-01-16 19:29:55 -05:00
}
2015-01-16 20:46:58 -05:00
void Elevator::Run(double power){
// If we're not telling it to stop
if(power != 0.0){
SetUseEncoder(false);
}
2015-02-02 18:53:02 -05:00
motor->Set(power);
2015-01-16 20:46:58 -05:00
}
void Elevator::ResetEncoder(){
elevatorEncoder->Reset();
}
double Elevator::GetHeight(){
return elevatorEncoder->Get();
}
bool Elevator::GetElevatorBottom(){
return elevatorBottom->Get();
}
bool Elevator::GetElevatorTop(){
return elevatorTop->Get();
}
void Elevator::SetUseEncoder(bool param){
useEncoder=param;
}
bool Elevator::GetUseEncoder(){
return useEncoder;
}
2015-02-08 12:26:15 -05:00
// vim: ts=2:sw=2:et