View Single Post
  #12   Spotlight this post!  
Unread 24-02-2007, 17:08
The Lucas's Avatar
The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: Programming tricks (and former trade secrets)

Quote:
Originally Posted by Cuog View Post
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 View Post
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".
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"

Last edited by The Lucas : 24-02-2007 at 17:44. Reason: spelling, Multiquote