View Single Post
  #3   Spotlight this post!  
Unread 04-10-2006, 17:36
Eric Finn's Avatar
Eric Finn Eric Finn is offline
Registered User
FRC #0166 (Chop Shop)
Team Role: College Student
 
Join Date: May 2006
Rookie Year: 2005
Location: Merrimack, NH
Posts: 101
Eric Finn has a spectacular aura aboutEric Finn has a spectacular aura about
Send a message via AIM to Eric Finn
Re: Program doesn't effect robot

Did you try inserting printfs for the joystick values (including buttons), to make sure the robot is getting the joystick input?

printf("%d\t%d\t%d\t%d\n", p1_y, p2_y, p2_sw_trig, p2_sw_top);

Is everything plugged in (the motors)?

I'm not sure if it was a problem with copying, but there's no ending curly brace for Default_Routine.

Oh, also, a few other things, that probably aren't causing your problem, but might cause other problems:
(In the code, I changed all "x == 1" to just "x" and "x == 0" to just "!x". It's still exactly the same.)

Code:
		if (p2_sw_trig)
		{
			pwm06 = p2_x / 4; //pan
			pwm07 = p2_y / 4; //tilt
		}
That will cause PWMs 6 and 7 to always have a value from 0 to 64, depending on the joystick value (0 to 255). Never mind if that's what you were trying to do.

Code:
	if (!p2_sw_top)
	{
//some code here...
	}
	else
	{
//more code...
	}
	if (p2_sw_top)
	{
//even more code...
	}
If you're pressing down p2_sw_top, both what is in the else and what is in the if (p2_sw_top) will execute. This probably won't cause problems, but it's just sort of redundant.
__________________
It always takes longer than you expect, even when you take into account Hofstadter's Law.
--Hofstadter's Law


Last edited by Eric Finn : 04-10-2006 at 17:39.