|
|
|
![]() |
|
|||||||
|
||||||||
Hi,
This file contains three documents.
C Programming Guide (34 pages)
========================
Uses free IDE/Compiler so students can learn and practice the basics of C programming at home or school. Allows students to understand how to read and make meaningful changes in the Robot default ...
Hi,
This file contains three documents.
C Programming Guide (34 pages)
========================
Uses free IDE/Compiler so students can learn and practice the basics of C programming at home or school. Allows students to understand how to read and make meaningful changes in the Robot default code.
Autonomous Programming (12 pages)
===========================
Explains 9 modes of autonomous operation. All code tested and verified on an actual robot. Great place to start when you don't know where to start.
Programming Notes (6 pages)
======================
Demonstrates several pieces of code that makes programming more interesting. I use this because my memory forgets within 24 hours.
Good Luck in 2005
With Regards,
Chuck Bolin, Team 342
1103227678programmingteam342.zip
19-12-2004 22:35
Billfred
Congratulations, Chuck--I guess it takes a South Carolinian to speak to a South Carolinian. This is the first programming white paper that actually clicked with me. (I'm not a programmer by any stretch. But I guess that's obvious).
One question, on the line tracking example in the autonomous notes...at Position D, when the left sensor is made, shouldn't the robot turn to the left instead of the right?
But other than that, bravo!
20-12-2004 07:21
Gamer930
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:
//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
}
09-01-2008 19:32
ComputermasterI am a newbie; this is my first year in FRC. I know how to program in many other languages, but C is a new one for me. If anyone has any tips or advice on programming for a newbie, I'd be much obliged.
All I have to learn it at home is a college textbook...I'm a freshmen in High School! Anyway, any help would be greatly appreciated. Thanks!