123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|612|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> Variable management problem

Posted : Wednesday, 23 February 2011, 17:43
jedimastersterli
So I found a C based programing compiler for my robot. I have a question though. The Robot comes with a ultrasonic sensor for measuring distance. My idea is to spin the sensor so that it can see more than one point.

The problem is this, i really don't want to write fifty different variables and fifty different sets of code for treating them. So i'm wondering if it's possible to have the computer write it's own variables or have the same line of code treat the seperate variables. what do you think?
Posted : Wednesday, 23 February 2011, 19:05
oscar
could you not do it using a multidimensional array? that way you could keep track of each of the values and be able to figure our what order they were gathered in fairly easily.
Posted : Thursday, 24 February 2011, 05:44
JL235
Do you mean you want to be able to store the distance at each angle around the object? Then you'd use an array: