View Single Post
  #11   Spotlight this post!  
Unread 08-02-2006, 11:13
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Will camera keep running if i have a while statement going

Quote:
Originally Posted by NextPerception
i am just going to post what i have mabye someone can tell me haow i would do this without stopping my entire program. This is my first year programming for first and i have promised my team some nice "features". any help would be greatly appreciated
Code:
 
if (p1_sw_trig == 1)
{ 
Switch1_LED = 1 // aiming light turns on when aiming
locked = 0
	while (locked == 0)
{
if (PAN_SERVO > PAN_CENTER_PWM_DEFAULT + 20)
{
pwm01 = 127 + aim_gain
pwm02 = 127 + aim_gain
} 
else if (PAN_SERVO < PAN_CENTER_PWM_DEFAULT - 20)
{
pwm01 = 127 - aim_gain
pwm02 = 127 - aim_gain
} 
	 else if (PAN_SERVO < PAN_CENTER_PWM_DEFAULT + 21 & PAN_SERVO > PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 127 + aim_soft_gain
pwm02 = 127 + aim_soft_gain
} 
	 else if (PAN_SERVO > PAN_CENTER_PWM_DEFAULT - 21 & PAN_SERVO < PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 127 - aim_soft_gain
pwm02 = 127 - aim_soft_gain
} 
else 
{
Switch1_LED = 0 // really cool light scrolling that i had to put somewhere in the code
Switch2_LED = 0
Switch3_LED = 0
Switch1_LED = 1
Switch1_LED = 0
Switch2_LED = 1
Switch2_LED = 0
Switch3_LED = 1
Switch3_LED = 0
Switch2_LED = 1
Switch2_LED = 0
Switch1_LED = 1
Switch1_LED = 0
		printf("\TARGET ACQUIRED");
locked = 1
}
}
}
How about instead of putting the if statements inside a while(locked==0), put them inside a giant if(locked==0)?
__________________