text
stringlengths 0
715
|
---|
Brain.Screen.print(Brain.Battery.current());
|
Brain.Screen.newLine();
|
Brain.Screen.print("Left Motors temp: ");
|
Brain.Screen.print(LeftMotors.temperature(percent));
|
Brain.Screen.newLine();
|
Brain.Screen.print("Right motors temp: ");
|
Brain.Screen.print(RightMotors.temperature(percent));
|
Brain.Screen.newLine();
|
Brain.Screen.print("Flywheel temp: ");
|
Brain.Screen.print(Flywheel.temperature(percent));
|
Brain.Screen.newLine();
|
Brain.Screen.print("Intake temp: ");
|
Brain.Screen.print(Intake.temperature(percent));
|
Brain.Screen.newLine();
|
Brain.Screen.print("Indexer temp: ");
|
Brain.Screen.print(Indexer.temperature(percent));
|
Brain.Screen.newLine();
|
tempDrawMode = drawMode;
|
drawMode = 3;
|
}
|
void buttonBReleased() {
|
//we changed the drawing mode while we were holding down B, so change it to the new one
|
if (tempDrawMode < 9) {
|
drawMode = tempDrawMode;
|
}
|
}
|
void buttonYPressed() {
|
//change up what is drawn on the brain screen.
|
//drawPath = !drawPath;
|
//drawFlywheelGraph = !drawFlywheelGraph;
|
//start autonomous if A is held down while pressing Y
|
if (Controller1.ButtonA.pressing()) {
|
autonomousProgram();
|
} else if (Controller1.ButtonB.pressing()) {
|
visionAlign = !visionAlign;
|
printControllerSetup();
|
if (visionAlign) {
|
Controller1.Screen.print("Vision align enabled");
|
} else {
|
Controller1.Screen.print("Vision align disabled");
|
}
|
} else {
|
autonType++;
|
if (autonType > 7) autonType = 0;
|
printControllerSetup();
|
Controller1.Screen.print("Auton type: ");
|
Controller1.Screen.print(autonType);
|
}
|
}
|
void checkOverheating() {
|
//check for overheating in any of the motors
|
if (LeftMotors.temperature(percent) > 50 || RightMotors.temperature(percent) > 50 || Flywheel.temperature(percent) > 50 || Intake.temperature(percent) > 50 || Indexer.temperature(percent) > 50) {
|
if (overHeatingTimer == 0) {
|
Controller1.rumble(rumbleLong);
|
printControllerSetup();
|
Controller1.Screen.print("Overheating Warning");
|
overHeatingTimer++;
|
} else {
|
overHeatingTimer++;
|
if (overHeatingTimer > 750) overHeatingTimer = 0;
|
}
|
}
|
if (Controller1.ButtonR2.pressing() && !Controller1.ButtonB.pressing()) {
|
printController(Intake.velocity(rpm));
|
wait(500, msec);
|
}
|
}
|
void init() {
|
//initialize settings, variables, and callback functions
|
Flywheel.setStopping(coast);
|
Intake.setStopping(coast);
|
Indexer.setStopping(coast);
|
LeftMotors.setStopping(coast);
|
RightMotors.setStopping(coast);
|
gain = defaultGain;
|
//callbacks for other driver controls
|
//intake
|
Controller1.ButtonL1.pressed(buttonL1Pressed);
|
Controller1.ButtonL2.pressed(buttonL2Pressed);
|
Controller1.ButtonL1.released(buttonL1Released);
|
Controller1.ButtonL2.released(buttonL2Released);
|
//expansion
|
Controller1.ButtonR1.pressed(buttonR1Pressed);
|
Controller1.ButtonR2.pressed(buttonR2Pressed);
|
//velocity control
|
Controller1.ButtonUp.pressed(buttonUpPressed);
|
Controller1.ButtonDown.pressed(buttonDownPressed);
|
//indexer
|
Controller1.ButtonLeft.pressed(buttonLeftPressed);
|
Controller1.ButtonRight.pressed(buttonRightPressed);
|
//other functions
|
Controller1.ButtonX.pressed(buttonXPressed);
|
Controller1.ButtonX.released(buttonXReleased);
|
Controller1.ButtonA.pressed(buttonAPressed);
|
Controller1.ButtonB.pressed(buttonBPressed);
|
Controller1.ButtonB.released(buttonBReleased);
|
Controller1.ButtonY.pressed(buttonYPressed);
|
//background tasks (very important)
|
//task myTask = task(updatePosition);
|
task myTask1 = task(flywheelVelocityControl);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.