|
Re: White Paper Discuss: C Programming and Autonomous Modes for Newbies
I read this yesterday morning. I thought it was great also. I sent him a PM with my thanks.
I didn't notice this error yesterday but now reading it again I do see it. It seems like he messed up that whole section.
Here is what I think It should look like:
Code:
//place this line before while (autonomous_mode).
unsigned char s_left = rc_dig_in01;
unsigned char s_middle = rc_dig_in02;
unsigned char s_right = rc_dig_in03;
//place this after Getdata(&rxdata);
if (s_left == 0 && s_middle == 1 && s_right == 0)
// Middle sensor on
// Go straight
{
pwm01=160; //left motor
pwm02=160; //right motor
}
else if (s_left == 1 && s_middle == 1 && s_right == 0)
// Left 2 sensors on
// Turn soft Left
{
pwm01=127; //left motor
pwm02=160; //right motor
}
else if (s_left == 1 && s_middle == 0 && s_right == 0)
// Left sensor on
// Turn Hard Left
{
pwm01=127; //left motor
pwm02=180; //right motor
}
else if (s_left == 0 && s_middle == 1 && s_right == 1)
// Right 2 sensors on
// Turn soft right
{
pwm01=160; //left motor
pwm02=127; //right motor
}
else if (s_left == 0 && s_middle == 0 && s_right == 1)
// Right Sensor on
// Turn Hard Right
{
pwm01=180; //left motor
pwm02=127; //right motor
}
else //stop
{
pwm01=127; //left motor
pwm02=127; //right motor
}
The other error I saw was in Table 3 First Row, First Column (on the bottom of page 5), that should be Turn Left. The numbers and diagram is still correct
Again, Great Job Chuck
__________________
2010 to Present, Scorekeeper/Field Power Volunteer for FRC/FTC/FLL
2005 - 2010, Team 171 College Mentor
2002 - 2005, Team 930 Student
Last edited by Gamer930 : 20-12-2004 at 07:22.
Reason: Tried to fix indenting on code
|