Programming robot to do things in order

Hello,

I am building a robot arm for a school project (university junior year). The gist of the project is that the robot arm rotates around a central position, and a trolley can move along the arm. Attached to the bottom of the trolley is an LED controlled color sensor. A block with different colored sides will be placed at one of several known locations around the base of the robot, and the robot will need to rotate to the correct angle, and move the trolley to the correct distance so that the color sensor can detect the color of the top face of the block.

After it has moved to the first block, I want the robot to move to a second location, then a third, and so on until it has gone to all known locations. Is there a way to have this done in the loop structure? I have thought about how to do this for one particular location (angle and radius), but I am having a hard time figuring out how to make it go to more locations.

I am using an Arduino Uno and DFRobot Romeo v1.3. Since I'm not having a particular code fix question, I wont post the full code unless needed, it is a very long code so far.

Thanks!

tabitha_twitchett:
I would put the angles and radii in arrays, use a counter to keep track of where you are, then when you have finished what you're doing at the first (actually zeroth) station, increment the counter and read the next position. Rinse and repeat.

I guess I would add to that suggestion. If you have no way of knowing when a step is complete, add to the array, the time in milliseconds to allow the step to complete, then code your program to time the start to end and wait for the set value to be matched or exceeded.
Paul

Thanks for the responses! I am sort of unfamiliar with using arrays in arduino, so I'll have to look into that. I use arrays a lot in matlab, but that's it. Is there a standard way of telling my loop to look for the next position in the array? An if statement that checks for the current position?

kuohaj:
Thanks for the responses! I am sort of unfamiliar with using arrays in arduino, so I'll have to look into that. I use arrays a lot in matlab, but that's it. Is there a standard way of telling my loop to look for the next position in the array? An if statement that checks for the current position?

I expect it is just like matlab. Use an index or subscript or any other name you like. It's like: array[0] or array[1], or array[n] where n is a variable you can set.. Remember in C, arrays begin at zero!
Paul