Led options help

I’m not certain I understand, but I think you are saying in led-toggle-dim.xodball you hold the button to go into program mode (which turns on LED), then it starts getting brighter until you release button. On next button press it should get dimmer until you release the button, then the system resets (LED should be “on” at new brightness). Next button press should turn the LED off (you are saying nothing happens with this press?). If you dim the LED until it is off, then both on & off state will be 0 and you will need to hold the button down long enough to go into program mode and brighten the LED again.

This is my new button led adjustment program. In this one it starts off with full power and you can turn it off and on like normal with button. You can also dim the led light down by holding the button down when you turn the led on. Hold the button down for 2 seconds and the light will go into its dimming cycle. You pick the brightness level by letting go of the button.
led light with button hold adjust.xodball (8.0 KB)

great friend, that’s awesome, can you make fade instead of dim fixed value

You mean like this? All I did was change the clock interval and count step values.

led light with button hold adjust (fade).xodball (8.0 KB)

To tell you the truth. The reason why I chose the step down is because leds are extremely efficient and its hard to tell when they start to fade and its usually at the very end or lowest of the pwm signal and then bam its 100 again in my program. I have yet to learn how to map range it into something useful.

ok, i get it. Thank you very much, it helped me a lot and what you did anyway …

gweimer, where or how can i make a count node with inc and dec, if i make an additional port and call it decreese will it work that function or?

Just adding a new input to a patch will not change the function of the patch. You need to tell the patch what to do with the node. In the case of the built-in count node, the input/output pins are not linked to anything because it has a not-implemented-in-xod node. If you double-click on that node, you will see the C++ code describing what the node does. For count, that is:

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
Number count = getValue<output_OUT>(ctx);

if (isInputDirty<input_RST>(ctx))
    count = 0;
else if (isInputDirty<input_INC>(ctx))
    count += getValue<input_STEP>(ctx);

emitValue<output_OUT>(ctx, count);

}

To Add a DEC input, you need to add the input-pulse pin, name it DEC, then add code for what to do with it:

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
Number count = getValue<output_OUT>(ctx);

if (isInputDirty<input_RST>(ctx))
    count = 0;
else if (isInputDirty<input_INC>(ctx))
    count += getValue<input_STEP>(ctx);
else if (isInputDirty<input_DEC>(ctx))
    count -= getValue<input_STEP>(ctx);

emitValue<output_OUT>(ctx, count);

}

ok but where i enter that code i thought i just copy the INC and call it DEC? or do i just have to type in some code …?

I’m not sure either. I think he’s saying you have to do c++ programming to create that node. Luckily for you it’s already been created by someone else. Just type this into your add library search in xod.

hitec-tenshi/up-down-counter@0.0.4

ok…ok thank you very much …

this works great, the question … can i when i stop the intensity and when i press the button again and hold it then it goes up fading …

Maybe with the counter node with the increase and decrease pins and some smart way to fit it into the program. Ill have to think about it and see if i can come up with anything.

Well… I don’t know how to do that yet. I did figure out how to turn the button off and when you turn it back on for another 2 seconds then it fades down. Sorry for the rat tail mess in this. It gets a lot more confusing when trying to jump through two different options.adjustable led with button fade up and fade down.xodball (17.5 KB)

how can i define that my diode does not flicker when it’s very bright at the transition … like in the video