View Single Post
  #10   Spotlight this post!  
Unread 08-02-2006, 00:43
NextPerception NextPerception is offline
Sleep-Deprived
AKA: Matt
FRC #0437 (Richardson Robotics)
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2005
Location: Richardson, TX
Posts: 69
NextPerception has a spectacular aura aboutNextPerception has a spectacular aura aboutNextPerception has a spectacular aura about
Send a message via AIM to NextPerception
Re: Will camera keep running if i have a while statement going

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
      }
    }
  }
__________________
What is this S - L - E - E - P you speak of?
Battlebots - My Robotics Website