Hi.
Is it possible to program the Robovation Kit such that it will run “autonomously” for a given length of time and then stop? In other words, since we don’t have a RC transmitter / receiver to use right now - can we still get the thing to do what we want without it?
Thanks,
Murf :rolleyes:
Yes, this is actually quite easy, and no it was not a dumb question.
The best I can explain it would be through code:
unsigned long int timer = 0;//Global variable declared right under the includes
...Code ommited for posting purposes...
//This function gets called every 17ms, therefore you just use a global variable that increments everytime this function is called to keep track of the time that is going by.
void Process_Data_From_Master_uP(void)
{
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
Default_Routine(); /* Optional. See below. */
/* Add your own code here. */
if(timer <= 85)//Both pwms full forward for first 5 seconds (17 * 5= 85)
{
pwm07 = 255;
pwm08 = 255;
}
else if(timer > 85 && timer <= 119)//For next 2 seconds turn
{
pwm07 = 0;
pwm08 = 255;
}
else //else sit there
{
pwm07 = 127;
pwm08 = 127;
}
timer++;//Increment the variable
printf("PWM OUT 7 = %d, PWM OUT 8 = %d
",(int)pwm07,(int)pwm08); /* printf EXAMPLE */
Putdata(&txdata); /* DO NOT CHANGE! */
}
and there you go. You just have to edit the Process_Data_From_Master_uP function in user_routines.c. Hope I helped :). Basically you just use this function to simulate autonomous, but if you need something to update faster then 17ms you need to place it in a different spot.
Thanks Ken! I appreciate the help.
Murf