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

Wed, 23 Feb 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?
Wed, 23 Feb 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.
Thu, 24 Feb 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: