|
Autonomous tutorial
Does anyone recall a set of examples on autonomous programming on this website? I saw it a few months ago, but cannot find it again. Several exercises were given demonstrating the use of a counter variable to control the actions of the robot at certain time intervals. It also talked about how to convert from loop intervals to seconds.
For example, it went something like this:
//user_routines.c
int counter;
.
.
void user_routines(void);
int t;
.
.
counter = counter + 1; //loop count
t = (counter / 28); //seconds
if (t < 280) { //go straight for ten seconds
pwm01 = 200;
pwm02 = 200;
{
else if (t > 280) { //turn left at 10 seconds
pwm01 = 200;
pwm02 = 127;
}
etc.
I thought it was a good exercise and would like to use it in a lesson plan.
Thanks.
|