Dial controlled by a radio button


#1

Hi,

I'm trying to make a weird dial which works like this :

the object is linked with another radio button which control the step (so I can edit several dial selecting one button like this :

The boolean input control the EDIT / RUN mode :
When we are in EDIT mode, we select one step with the radio, then we set/save the value on the dial.
When we are in RUN mode, the dial change with values that we set to it previously.

It's like a step sequencer, but with one dial.

At this time, I can :
change the radio button from my dial by the previous radio button object, but the visual doesn't update. Like this :

As you can see, my radio button is set to 1 and my dial outputs 1 but the dial's radio button is still at 0.
Can we update the visual ?
For the code I've just set

param_p1 = inlet_STEP;
outlet_o1 = param_p1;

I can't :
set the value of the dial by the p1 parameter (my dial radio button) :
I've tried this where the param_value is my dial :

if (param_p1==0){ param_value=10;}
if (param_p1==1){ param_value=20;}
if (param_p1==2) {param_value=30;}
if (param_p1==3) {param_value=40;} 
outlet_out= param_value;

but the param_value doesn't change as well and it doesn't output anything...

The next step is to save values then read it, but I don't think it will be a problem with my bool.

So does anyone know how to update the parameters visual of my object without using a disp function ?
And how to set the value of the dial with the radio button ?

Thank !


#2

It fails because of trying to change param_p1 within the code , this is for manual input.
you already have an output for the radio button input with outlet showing the correct value in the disp/I, add another output to replace the param_value to another disp object, recommend another disp/I object, and you should be able to see the correct step value.
Remove param_p1 and param_value, they won't update as per your code, this is for disp objects only.


#3

Okay, I've corrected mistakes. But I still can't directly write to an output like :
output_myOutput = 10;

How to do this ?

Thank !


#4

You can modify parameters with the parameter change function, however it's expensive in terms of cpu consumption (i suppose it's because it requires i/o between the board and the patcher)

you can see the PExParameterChange function defined here: https://github.com/axoloti/axoloti/blob/605c1e9a81843a6b465193e956ae3d2e94596c81/firmware/parameters.c (just if you're a C geek), and you can see it used in some community library objects: https://github.com/axoloti/axoloti-contrib/search?utf8=%E2%9C%93&q=PExParameterChange

You can also search here in the forum, i have a feeling we already talked about this

As for the reason your object does not output anything, it's because blue outlets are fractional, while green outlets are integers. If you change the outlet to green you'll see the correct output.


#5

Oh, okay, I think PExParameterChange is what I was looking for.
Yup, but when you're a newbie it's sometimes hard to find the right keyword. But I guess - ok.

Yes, but a float should output an int...? no ?
I've tried to output a float to the blue and it doesn't output anything as well.
outlet_out=11.5;
When I try to output an int with an int outlet it works.

Cice


#6
https://sebiik.github.io/community.axoloti.com.backup/t/coding-axoloti-objects?source_topic_id=2892

All inlet/outlet/parameter types are integers. Fractional numbers are represented in fixed point (with the unity corresponding to 2^27 (1<<27)


#7

Hi,

So my object run fine now, PExParameterChange is what I was looking for.
Thank you Sputnki !