Programming Tips

From Team1370

(Difference between revisions)
(Compiling Errors got you down?)
Line 21: Line 21:
*Functions should be prototyped in a header file that is included in the .c file
*Functions should be prototyped in a header file that is included in the .c file
 +
== Team 1370 Robot Code ==
== Team 1370 Robot Code ==
Here is a link to the current version of our [[Robot Code 2006]], which is a good example of various programming techniques we use.
Here is a link to the current version of our [[Robot Code 2006]], which is a good example of various programming techniques we use.

Revision as of 14:20, 10 February 2006

Aliases to keep in mind

  • pwm## where the number ranges from 01 to 12 (and up to 16 if the "Generate_Pwms(pwm13,pwm14,pwm15,pwm16);" is included in the "void Process_Data_From_Master_uP(void)" function of the user_routines.c file)

The pwm## alias is used to assign an output value to the speed controllers according to the pwm slots that they are each plugged into. Values range from 0 to 255


  • p#_? where the number ranges from 1 to 4 and the ? sign is either "x", "y", or "wheel"

This alias represents the value of one of a specific joystick's axis positions. It may be from one of the four possible joysticks, of which it may be either the x-axis, y-axis, or throttle wheel (if one exists). Values range from 0 to 255


  • p#_sw_? where the number ranges from 1 to 4 and the ? sign is either "trig", "top", "aux1", or "aux2"

This alias represents the value of one of a specific joystick's buttons. It may be from one of the four possible joysticks, of which it may be either the trigger, top, or side buttons. Values are either 0 (normal) or 1 (pressed)


Compiling errors got you down?

  • Check for missing or extra semicolons and parentheses. They can be a real hassle.
  • Make sure you declare variables at the top of a function (remember, this is C, not C++)
  • Functions should be prototyped in a header file that is included in the .c file


Team 1370 Robot Code

Here is a link to the current version of our Robot Code 2006, which is a good example of various programming techniques we use.

Personal tools