Thread: loop problems
View Single Post
  #5   Spotlight this post!  
Unread 09-02-2006, 14:31
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: loop problems

Max

You can try something like this to set the pwm value to 127 after 30 loops:
Code:
void pulse(void)
{
  static int loop_count = 0;
  if(loop_count < 30)
  {
    pwm06 = 254;
  }
  else
  {
    pwm06 = 127;
  }
  loop_count++;
}
Then, you would want to call this in your main loop. Note that this method never resets loop_count, so this would run for 30 loops at 254 and then stop.