Programming Tips

From Team1370

(Difference between revisions)
Line 13: Line 13:
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)''
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)''
 +
 +
 +
*pwm01 and pwm02 are used by the camera code to control the servos. One thing to remember is that, unlike with a normal motor, the value of these correspond to positions (127 is center) such that assigning 200 would make the servos jump to that position -- instead of spinning forward at the given speed. Thus, the value can also be used in reverse, to determine the position of the camera.
 +

Revision as of 22:47, 11 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)


  • pwm01 and pwm02 are used by the camera code to control the servos. One thing to remember is that, unlike with a normal motor, the value of these correspond to positions (127 is center) such that assigning 200 would make the servos jump to that position -- instead of spinning forward at the given speed. Thus, the value can also be used in reverse, to determine the position of the camera.


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