void usercontrol() {
while (1) {
//checkMotorDegree(rightLift);
assignbraketypes();
//expoDriveCode();
bruhmoment();
liftCode();
full180();
//liftCodeWithLimiter(rightLift);//WithLimiterButPressing();
//liftCodeWithLimiter(leftLift);
mainclawCode();
backclawCode();
backupDrive();
//testallmotors();
checkIfOverheating();
//WHEN TESTING, TAKE OUT ALL FUNCTIONS NOT NECESSARY. CHECK IF PERFORMANCE TAKES A HIT
wait(20, msec);
}
}
Here is the user control function from the google drive file.
Most of the functions above are void functions that just check for controller button presses or joystick values and perform an action. I would recommend using tasks to run all the checks simultaneously, but this method definitely works. I have never tried using tasks to check for multiple button presses at once, so I am not sure how well it would work.
I was never taught tasks (though technically speaking I was never taught in the first place) so idk what that is. Iâll do some research, but tbh itâs worked for our team so far so I probably wouldnât change it
Um, it looks like you forgot to add checkBattery(); to your while loop. Should be an easy fix. I think you could end up with a few bugs, though, like that whenever you push those two buttons, whatever they normally do will still happen. You could try:
if (ButtonRight.pressing() && ButtonY.pressing()) {
print(Battery.capacity());
}
else if (ButtonRight.pressing()) {
// Do whatever ButtonRight normally does
}
else if (ButtonY.pressing()) {
// Do whatever ButtonY normally does
}
That way it will skip the else ifs whenever the first if is true, and wonât turn on your conveyor or whatever when youâre just trying to check the battery level.
No I did. Itâs âââmaintenance();âââ since I have all my maintenance functions inside of one function as well. I just took it out of the code because I wasnât using it since it didnât work. I did input batterycheck(); directly though, and it still didnât work
Oh! In the original code snippet you posted, it looks like you put a space between checkBattery and (). Is that true? Itâs not supposed to have a space. But I would be surprised if it didnât flag that.
It might just be a problem with printing to the controller screen. Have you had success before printing to the screen? Try adding below Controller1.Screen.print... something else verifiable like turn LED green or beep. That would be debugging.
Itâs possible youâre not using the printing command correctly. In VEXcode IQ, which is (also) based off C++, you have to say Brain.Screen.print("%f", Brain.Battery.capacity(percent));, and if you leave out the %f it will give you an error. (If V5 code is the same, %.0f will print will 0 decimal places, %.1f will print will with 1 decimal place, etc.)
You might have to set the cursor. I wouldnât think so, but itâs worth a try. You may also want to clear the screen at some point.
No, thereâs no space in the code, itâs jsut me typing what I remember. And also, yes printing things does work, I have code for when motors overheat and the controller just says OVERHEATINGGGGGGGG. I will set the cursor at 0,0 when I get to the club in 5 minutes