Quote:
Originally Posted by Cuog
You can use the LEDs on the OI and have them turn on when the joystick input is where you want it.(for info on this look at the bottom of default_routine() in the default code
|
Quote:
Originally Posted by Jake M
Very true, but my whole reasoning for making such a circuit is not simply to let us see when the joysticks are trimmed or aren't, it's to let us do so without using up other OI features (such as the LEDs) which we could use for other feedback, concerning the actual driving of the robot. We can only acesss 8 of them, through the joystick ports and we could easily find 8 other uses for an LED.
|
I wrote a routine like this years ago and it goes into the code for both my teams every year. Here is what I use: ( I just added some defines for portability)
Code:
#define CALAXIS1 p1_y
#define CALAXIS2 p1_x
#define CALAXIS3 p3_y
#define CALAXIS4 p3_x
if (disabled_mode)
{
//when joysticks are calibrated
//all 8 LEDs will be on
Pwm1_green = (CALAXIS1 >= 127);
Pwm1_red = (CALAXIS1 <= 127);
Pwm2_green = (CALAXIS2 >= 127);
Pwm2_red = (CALAXIS2 <= 127);
Relay1_green = (CALAXIS3 >= 127);
Relay1_red = (CALAXIS3 <= 127);
Relay2_green = (CALAXIS4 >= 127);
Relay2_red = (CALAXIS4 <= 127);
}
else
{
//whatever you normally do with the LEDs
}
It only uses the LEDs while the bot is disabled, since it should be calibrated before enabling. You are free to use the LEDs as you would during the match, just put that code in the else statement. Just make sure your LEDs are set every loop to avoid confusing the drivers with stray lights.
Basically you just have to play with the calibration trimmers until both red and green LEDs are ON for that axis. Might be tough at first but you will get the touch. All 8 LEDs ON = "Calibrated and ready to go".
