Sensor "Name" iteration

My goal is to display all of my defined sensors’ names in a menu system on an LCD screen. I don’t wish to have to create a string array of the names of all of the sensors because we may often change them.

So, my question is, can I iterate through the sensors and their properties defined in the #pragma?

All i have found so far is an enum of tSensors, but i cannot use that to retrieve the name from them.

I’m using robotc 4.X

I would guess you would have to a statement like this


String text="";
if (enum==1)
  text="something 1";
elseif(enum==2)
  text="something 2";

repeat as needed
 

You can iterate through the sensors, find the type and print the value of each one. I don’t think there is a way to find the name you gave it in the sensor&motors dialog at runtime, you would just have to use port1, port2 etc.

Okay, thank you. I will see if I can suggest something like this to the robotc developers, so they might implement this in later versions.