steve d
02-02-2008, 20:12
We're getting strange pwm trouble in Autonomous Mode. If I put pwm13 = pwm14 = 127 in User_Autonomous_Code(), the speed controller's LED are green and motors turn. If I use pwm13 = pwm14 = 0 or if I use pwm13 = pwm14 = 255, both make LEDs turn off and motors spin opposite. If I do this in the default routine, it works right: 127, LEDs are orange; 255,green and 0 red.
Can anyone tell my why the PWMs act different in Default and Autonomous?
here's the code in User_Autonomous_Code() :
...
/* Add your own autonomous code here. */
Remote_Controls();
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
...
}
void Remote_Controls()
{
// if Remote # 2 is pressed, stop
if (rc_dig_in02==0)
{
pwm13 = pwm14 = 127;
pwm15 = pwm16 = 127;
}
// if Remote # 3 is pressed, backup
if (rc_dig_in03==0)
{
pwm13 = pwm14 = 0;
pwm15 = pwm16 = 0;
}
// if Remote # 4 is pressed, fwd
if (rc_dig_in04==0)
{
pwm13 = pwm14 = 255;
pwm15 = pwm16 = 255;
}
}
Can anyone tell my why the PWMs act different in Default and Autonomous?
here's the code in User_Autonomous_Code() :
...
/* Add your own autonomous code here. */
Remote_Controls();
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
...
}
void Remote_Controls()
{
// if Remote # 2 is pressed, stop
if (rc_dig_in02==0)
{
pwm13 = pwm14 = 127;
pwm15 = pwm16 = 127;
}
// if Remote # 3 is pressed, backup
if (rc_dig_in03==0)
{
pwm13 = pwm14 = 0;
pwm15 = pwm16 = 0;
}
// if Remote # 4 is pressed, fwd
if (rc_dig_in04==0)
{
pwm13 = pwm14 = 255;
pwm15 = pwm16 = 255;
}
}