Im developing a set of subroutines to make it easyer for my teams programmers. But when i tried to show them how to call them it calls the first one and stays.
example: From user_routines_fast.c
This is the autonomous code i made to test calling subroutines [line: 141]
Code:
/*******Autonomy Notes*********************
* "time" was initalized on line 24
* relay1_fwd/rev = Bottom Cylinder
* relay3_fwd/rev = Top Cylinder
* pwm01 = Left Drive motor
* pwm02 = Right Drive motor
* pwm03 = Shooter
* pwm04 = Tilt
* 26 loops = One Second (roughly)
****************************************/
if (time >= 0 && time < 50)
{
Left();
}
else if (time > 50 && time < 100)
{
Stop();
}
else if (time > 100 && time < 150)
{
Right();
}
else if (time > 150)
{
pwm01 = pwm02 = 127;
}
time++; //Incriment time
These are the subroutines [line: 290 in user_routines_fast.c]
Code:
unsigned char Left()
{
pwm01 = 0;
pwm02 = 254;
return 0;
}
unsigned char Right()
{
pwm01 = 254;
pwm02 = 0;
return 0;
}
unsigned char Stop()
{
pwm01 = pwm02 = 127;
return 0;
}
The FUNCTION PROTOTYPES for the subroutines in user_routines.h
Code:
unsigned char Left(void);
unsigned char Right(void);
unsigned char Stop(void);
Can anyone tell me why when i run this it stays in Left()??????????
thank you in advanced