How to make a message of a slider generic?

Hello everybody,

I am working on an app to control my custom build Arduino or Teensy hardware tools via bluetooth. Ai2 seems to be a great help for that to make it easy.

However, I am not sure if I understand the funcionality of "make generic": Is it only possible to set a parameter in the corresponding component?

I have several sliders (it will get 50 or more at the end) which should send the index of the slider (e.g. Slider1_) and the value (=thumbPosition) like this:


(Additionaly a label on the screen shows the value)
This is working fine so far.

Is there a way to make this generic?


Can I get a useful index fom "component" to use as text/integer? Is there no way to get the name of the component (i.e. "Slider1")?
(Is there a way to map the slider to a label to show the value?)

Usually people keep lists of component blocks, and use the index in list block to identify a component against that list.

Alternatively, use the .Text value of a component, if it has one.

Sample projects:

Thanks for the reply.

Using lists and indices seems to be a possible workaround to make this generic. I hoped there would be an easier way. I will look further into your example. Many thanks.

There is no Text value for the slider. Otherwise I wouldn't have that problem and could use it. It is a pity that there is no way to get the name of a slider (and everything else).

You can init a global table (list of lists) with component blocks in column 1 and text names in column 2.

Then use the lookup in pairs list block to turn component to text name.

Good to know. Maybe this will be helpful if I need more than the indices.

At the moment it seems that this would be even more effort as generating a list containing all the sliders, wouldn't it?

OK, this is working as intended:



(of course not much error handling yet)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.