Programming with Two CMU Cams

With one camera connected to the serial port, and one to the programming port, how should our team go about programming so each can track a light? Thanks in advance.

You’ll probably want to just take the camera.c and tracking.c (and their related .h files) and make a copy. Then change all of the static and extern variables to slightly different names. Then just call the camera handler and the servo track in User routines. Shows the laziest of the lazy version of this code. There are some changes marked with “Brian” in the tracking2.h, tracking2.c, and tracking.h to limit the scope of each camera to half on either side, and reverses so they each start in the middle and spread out.

Its never a great idea to name some slightly different for better read ability use _. Like if I had a function that writes I should name it write_function. Same with headers and source files. Unless its local variables dont just add a 1 or a random X. It will save you the headache in the long run.

question for you…you said youv connected 2 cameras to your RC, both to the 232 ports…how did you go about connecting the cameras that way and how did you transmit info during runtime? thanks


You set up one camera normally through the TTL port with the TTL to 232 adapter. The second goes through a modified serial cable that connects the programming port to your camera.

The easiest way to simply test everything is to buy a null modem cable connector for your serial cable and simply plug the camera serial directly into the programming port.

To test whether or not it’s working all you need to do is download the default camera code and change the line in camera.h from





You won’t have any terminal with two cameras. You must make sure that if you use both that you set
stdout_serial_port = NUL; in user_routines User_Initialization.

Some extra notes:
If you decide to modify the cable to go to a PWM output (which is what you’ll do if you decide to go into competition with it) You’ll need to ruin a serial (or make your own) and make the following connections:

1 0 2 3 0 << This is the serial port on your Robot controller
0 0 0 0

connect pin one to the black on a PWM, pin 2 to the red, and 3 to the white/yellow.

You would need a null modem cable, not just any male-to-male cable.

Here is some more info about null modem cables, including wiring diagrams in case you wanted to make one yourself by splicing two cables.

Sorry, fixed.

Oh, and for those of you who are using, the code I’ve now made it so that it works like originally planned. The Cameras both pan from left to right in a full arc. All of the edited code was removed save for the dual camera functionality.