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.