Free programming help

OK now that i have completed about 50% of the coding for my team and will likely be done with our boring autonomous codes by the end fo the week.

I will now try to aid other teams especially those with rookie programmers to get their code up and going, for help you can PM me or AIM me or Email me:

Aim: way2fst79ta
email: fst79ta AT gmail DOT com

please feel free to ask for any help I need something to do!

Good Luck,

Heh. Done eh?

A real programmer is never done. There is always something that can be improved. How about improving those “boring” autonomous modes?


Start playing with the camera if you are done… even if your team can’t use it this year, it’s not something thats going to go away any time soon. It doesn’t need much to get working…

Don’t you hate it when it says “You must spread some Reputation around before giving it to Tom Bottiglieri again.” :frowning:

Also i would like to note these sites are all about helping FIRST programmers:

I think all of these sites sorta need a boost… discuss stuff if you can, download code and mess with it, or upload new code on the ones you can. :wink: :smiley:

P.S. I know i missed some sites… sorry.

Cool, Then theres a small chance I may be emailing you. But before I destroy my own robot with some bad code…
Do you have any tips for Dead reckoning autonomous mode? I don’t think I know enough to use a potentiometer (or however its spelled).
Also, I have heard that some people making a dongle isn’t as easy as it looks and can mess up your rc controller thingy, Should we just buy one or try to make the dongle? Right now I am going to set up a button press on the controller to start auto but I don’t think that would be as good as it sounds.

i am on a rookie team and am the best choice for programmer only i have no experience and neither does anyone else on my team. i don’t even know where to start

I am just curious what do you plan on doing in auto? Most teams are no where near having a robot that can be completely programmed nor will they be until the end of week 6. If some how you actually finished then I would recommend you try to do something else in auto. If you saw the game last year auto was very boring, almost nothing happened. If you really do have that much time left then work on integrating new sensors to do different things, I cannot imagine you are doing much more than drive some place by counting loops. In the next few weeks try to give your code more structure and make your auton a little better. In this game auton can make or break a team.

If you want a good example of code look at the code Mike posted in the white papers from last year. His code uses pots and the camera, is structured very logically, is commented well and was extremely functional. Until your code looks like this you are far from done.

Thank you :slight_smile:
My code is located here: Team 237 Triple Play Code

I’m also willing to help people, as long as they are willing to use decent spelling/grammar and learn. I don’t want to talk to people that go “Hai, culd u make mi autonomus wurK? thxxxxx.”

You can IM me at MikeWasHere05

Not that I advise doing this, but we’ve enabled the extra channels with a paper clip before. That would be a very bad idea for auton code though. If you have someone on your team who can solder decently, it should not be a problem to make one. Check it a couple times, then get someone else to check it if you are that worried.

Ok to those who claim i am not done with my code i admit that is an exaduration, i still have a lot of testing and debugging that i need our mechanical to finish the design so until then i am done, also i have done a number of playing with kevin watson’s code for the camera and i have even modified his tracking algorith so that i can tell it to search certain zones where the light should be.

Now for those asking help:
OUMONKEY: for dead reckoning i would generally recomend against it, but if you want you can do it for a basic autonomous(2 of my three autonomous start out with it then they calculate where they are and travel to where it needs to go based on the camera input)

basically in dead reckoning you depend on the way your robot has behaved to tell where it should be on the feild, you can calculate this by taking what PWM value was sent for how long and use the robots speed to find where it is, accelerometers and gryos can be used to tell how the robots possition is changed, a vertically mounted gyro can tell you how much the robot has turned to make sure you know where you are pointed.

when you have actual code email it to me and i will help you get it working if you want

I would recomend that you start by looking at some C tutorials found hiding on also download the default code from or download the camera code from and use that if you still have questions once you have started then just let me know

Yes, I am on a rookie team, and given the fact that our school will not let us download the c compiler and the MPlab program to our computers, and my mentor wants me to find out if we put such gear drive to such pmw and have it work basically, THIS WEEK, how am I supposed to do it, and also, I have looked at the tutorial from the US first website,and I am still confused about c programming and would like some help understanding it.
Please can anyone help, I would be deeply indebted to you if you would.
Thank you.

PS sorry for any typos,or mispellings.

To be able to help you to get pointed in the right direction it will help me alot to know how much you already know about programming in general, if this is the first time you have done any large scale programming then i can understand the daunting task, this is the second largest programing project that i have ever had, although i have only been programming for 2 years,

now since you have read the .ppt files on USFIRST i would recomend that when you are at home you take the C-BOT CD and install the programs on your home computer, i would also recomend trying to convince your school division to allow you to install it on one of the computers, DO NOT INSTALL IT WITHOUT PERMISSION.

If your team doesnt want to do any custom programing yet then if you use the default code here is how each PWM is powered(i am doing this from memory so someone please correct me if i state something wrong):
pwm01 joystick 1 Y axis(forward back)
pwm02 joystick 2 Y axis
pwm03 joystick 3 Y axis
pwm04 joystick 4 Y axis
pwm05 joystick 1 X axis
pwm06 joystick 2 X axis
pwm07 joystick 3 X axis
pwm08 joystick 4 X axis
pwm09 sorry dont remember from here on out

using these PWM values you can hook up your victor 884 to the RC at these pinouts as per the manuals instructions(found at and you can set up pretty much everything for a funtioning robot.

there are also the spike relays that can be hooked up and they are set to relay1_fwd
relay2_fwd…(i dint remember what joysticks these go to but a quick search through user_routines.c in the 2006 default code will tell you)

Here you go, good luck if this doesnt help just email me or post a clarification so i can try again

thats one way to do it or if you actualy want to do some programming just go out and buy a really cheapo laptop just for programming. All you really need is an old laptop that at least runs windows 98

^^^^entirely true my programming rig is a pentium 2 win 98 machine but it works, that reference though was because i am unsure of where she is in the whole programming voyage

Here are the default code pwm and relay linkings with the joysticks and digital inputs


  pwm01 = p1_y;   //PWM01 value is the Y Axis on Joystick 1
  pwm02 = p2_y;   //PWM02 value is the Y Axis on Joystick 2
  pwm03 = p3_y;   //PWM03 value is the Y Axis on Joystick 3
  pwm04 = p4_y;   //PWM04 value is the Y Axis on Joystick 4
  pwm05 = p1_x;   //PWM05 value is the X Axis on Joystick 1
  pwm06 = p2_x;   //PWM06 value is the X Axis on Joystick 2
  pwm07 = p3_x;   //PWM07 value is the X Axis on Joystick 3   
  pwm08 = p4_x;   //PWM08 value is the X Axis on Joystick 4
  pwm09 = p1_wheel;   //PWM09 value is the wheel on Joystick 1
  pwm10 = p2_wheel;   //PWM10 value is the wheel on Joystick 2
  pwm11 = p3_wheel;   //PWM11 value is the wheel on Joystick 3
  pwm12 = p4_wheel;   //PWM12 value is the wheel on Joystick 4
  pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);   //Use Joystick 1 to drive 2 motors (pwm13 and pwm14)
  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);   //Use Joystick 1 to drive 2 motors (pwm15 and pwm16)


  relay1_fwd = p1_sw_trig & rc_dig_in01;  //Trigger relay1 forward only if Joystick 1 trigger is pushed and digital in 1 is true
  relay1_rev = p1_sw_top  & rc_dig_in02;  //Trigger relay1 reverse only if Joystick 1 top button is pushed and digital in 2 is true
  relay2_fwd = p2_sw_trig & rc_dig_in03;  //Trigger relay2 forward only if Joystick 2 trigger is pushed and digital in 3 is true
  relay2_rev = p2_sw_top  & rc_dig_in04;  //Trigger relay2 reverse only if Joystick 2 top button is pushed and digital in 4 is true
  relay3_fwd = p3_sw_trig;   //Trigger relay3 forward with trigger on Joystick 3
  relay3_rev = p3_sw_top;   //Trigger relay3 reverse with top switch on Joystick 3
  relay4_fwd = p4_sw_trig;   //Trigger relay4 forward with trigger on Joystick 4
  relay4_rev = p4_sw_top;   //Trigger relay4 reverse with top switch on Joystick 4
  relay5_fwd = p1_sw_aux1;   //Trigger relay5 forward with Aux1 switch on Joystick 1
  relay5_rev = p1_sw_aux2;   //Trigger relay5 reverse with Aux2 switch on Joystick 1
  relay6_fwd = p3_sw_aux1;   //Trigger relay6 forward with Aux1 switch on Joystick 3
  relay6_rev = p3_sw_aux2;   //Trigger relay6 reverse with Aux2 switch on Joystick 3
  relay7_fwd = p4_sw_aux1;   //Trigger relay7 foward with Aux1 switch on Joystick 4
  relay7_rev = p4_sw_aux2;   //Trigger relay7 reverse with Aux2 switch on Joystick 4
  relay8_fwd = !rc_dig_in18;   //Trigger relay8 foward with digital in 8 usually used with the compressor
  relay8_rev = 0;   //Do not allow relay8 to be reversed usually used with the compressor

And then the PWM lights on the controller are driven by the corresponding PWM port!

Enjoy and feel free to correct me if I am incorrect with any of these!

yes thats correct i just didnt have my code or my code book with me

Hi Rebekah, and welcome to Chief Delphi.

Something you may want to consider, if you feel you dont have the time/resources/support to tackle learning C programming in time to get a functioning robot (with an autonomous mode even, perhaps?), is the new software that intellitek provided all FIRST teams with this year; EasyC. EasyC is a GUI (Graphical User Interface) C programming tool that allows users to literally “Drag and Drop” blocks of C code. While you still need a basic understanding of program flow (if/then, else, loops, etc…), this program can DRASTICALLY reduce the learning curve and get you a functional program in very little time…

More info about EasyC can be found here:

I would highly suggest contacting your district and requesting installation of whatever development tools you choose on at least one machine in the school. Another option is if a team member has a laptop or spare desktop, you can set up a programming computer off of the network, so the district has no control over it. If all else fails, you absolutely NEED them to allow the installation of IFIloader on a computer WITH A SERIAL PORT (Or USB with a USB to Serial adapter Cabler…I’ve had good luck with the radio shack brand) AND ACCESS TO THE ROBOT, otherwise those nifty .hex files you compile at home(or at school, with luck) will be unable to be loaded to the Robot Controller (and that just wont do!).

If there is anything else I can do to help, you can drop me an email at or an IM (AIM, none of this MSN Messenger silliness…) at DespoticDreamer

Good luck!

-Dillon Compton

Cuog & ALL FIRST Teams,
I **propose ** all (many?) teams collaborate on a **‘Simple Set Path’ Autonomous Strategy (SSPA) ** via a CD forum. (SSPA?)

PRO: when cooperating teams ally they will score above average together in the auton. period. (AP)
(increase chance of near or perfect 100 pt AP score) by avoiding random collisions
i.e. use preset paths for each start position, so all have higher avg qual scores than those who don’t.
FIRST leaders, members & spectators will be happy with high scores !

Drive accuracy & shooting apparatus effectiveness will determine indiv best AP score.
No ally may be able to score from 18’ effectively.

SSPA proposal: (prepgm modes)
define 3 starting robot positions: Lead, Mid, Back (LMB)

3 bots drive straight line angle from LMB to centerline,
8’, 13’, 18’ from goal base, respectively & shoot 10 balls

Provides 2’ in front of ramp for lead bot and ~2’ between remaining ~36" bots

Engage CMUcam correction near end of fast init drive for AZ & EL then shoot.
(some will have to turn bot frame, others have a tracking turret)

Overwhelming advantage is the if each can drive within the 2’ margin corridor
they will not bump into alliance partners permitting max score potential.
Partners may choose to put better distance shooters in the M/B positions.

18’ should take only 3 sec, leaving 7 sec to align & stabilize and shoot 10

Alternative scheme (prepgm mode): (increased risk of collision)
L&M shoot quickly and move away from center
allowing B to drive forward after a TBD 2-3sec? delay then shoot from closer

Regards, Dale (294engr]

TO tell the truth the only things I know about the programming, is that there are if statements and else statements, and I’ll see if my mentors will let me install the MPlab on my home computer, and possibly I could bring it to school to use there, because I have no real connections on it, and I have no internet, I think though that with the help you have given me I can at least help them to make sure that the motors and joysticks work.
Yes, I will let you know if I end up needing further help, which I know I will, because none of my mentors know anything about c-programming.

Thank you in advance.