View Single Post
  #10   Spotlight this post!  
Unread 15-01-2008, 00:49
taggartbg taggartbg is offline
Registered User
FRC #1712 (Dawgma)
Team Role: Electrical
 
Join Date: May 2005
Rookie Year: 2006
Location: Lower Merion, PA
Posts: 38
taggartbg will become famous soon enoughtaggartbg will become famous soon enough
Send a message via AIM to taggartbg Send a message via MSN to taggartbg Send a message via Yahoo to taggartbg
Re: Getting constant motor power with IR board

To overcome this, I made friendly with Wait().

Another thing i've been considering however, is that if you print the value of GetDigitalInput(x), you get either a 1 or a 0. While the board is receiving a modulated IR signal, you get so many 1's and so many 0's in a row, alternating. Thus I think you can do something like this:

Quote:
int n = 0;
int nmax = number; //This value will be different per controller and button
if (GetDigitalInput(1) = 1)
{
while (n < nmax)
{
SetPWM(1,255);
SetPWM(2,255);
if (GetDigitalInput(1) = 0)
{
n++
}}}
This will keep the PWMs set, as long as the string of 0's (between the 1's) does not exceed a certain number. This number can be determined by adding a simple print and monitoring, and stopping at the right time, your terminal while pressing a button.

I'm not sure how well this would work, maybe something I'll play with tomorrow.