View Single Post
  Spotlight this post!  
Unread 25-01-2008, 12:03
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,533
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: MAKE A MOTOR PULSE????

The easy way to do this is:

You know that user_routines.c Default executes once every 26 (approx) ms.

That means that every 38 loops is nearly exactly 1 second. Simply write a counter, and then an if-then-else. It would look something like this:

count=count+1;

if (count == 38)
{
pwmXX=255;
count=0;
}
else
pwmXX=127;

Note you would want to declare the counter as a static variable.