|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
we are having issues with our IR coding in hybrid mode, below is what we have set up, for some reason its only running the first subroutine as if rc_dig_in10 is already initialized to "on" at the start of the code.
Auton Code: Code:
time1 = time1 + 1;
if (time1 <= 5)
{
rc_dig_in10 = rc_dig_in11 = rc_dig_in12 = rc_dig_in13 = 0;
pwm01 = pwm02 = 127;
}
else if (rc_dig_in10 = 1)
{
cmd0();
}
else if (rc_dig_in11 = 1)
{
cmd1();
}
else if (rc_dig_in12 = 1)
{
cmd2();
}
else if (rc_dig_in13 = 1)
{
cmd3();
}
else
{
rc_dig_in10 = rc_dig_in11 = rc_dig_in12 = rc_dig_in13 = 0;
pwm01 = pwm02 = 127;
}
Code:
unsigned char cmd0()
{
pwm01 = 190;
pwm02 = 190;
return 0;
}
unsigned char cmd1()
{
pwm01 = 64;
pwm02 = 64;
return 0;
}
unsigned char cmd2()
{
pwm01 = 190;
pwm02 = 64;
return 0;
}
unsigned char cmd3()
{
pwm01 = 64;
pwm02 = 190;
return 0;
}
Last edited by drewjones13 : 17-01-2008 at 20:35. Reason: Needed code blocks |
|
#2
|
||||
|
||||
|
Re: HELP!!! STUCK WITH SUB ROUTINES WITH THE IR!!!
I believe the if statements are your problem. You're only using one equals sign. That will actually assign the bit the '1' rather than checking equivalence. You need to use the == operator instead.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Out with the match list printouts, in with... | Pat Fairbank | General Forum | 19 | 07-02-2005 20:15 |
| need help with the ir | tinderfitles | Programming | 3 | 03-02-2004 15:31 |
| Help with the balls! | tchescow | Kit & Additional Hardware | 11 | 20-01-2004 10:52 |
| Help with the storyboard. | LizJJury | 3D Animation and Competition | 11 | 13-01-2003 08:37 |
| Help with the gyro chip | Team852 | Electrical | 1 | 10-01-2003 22:31 |