[I want a node] Pwm-load-and-switch

Basically I find it very frustrating to work with XOD because there are no nodes that can combine the PWM signals with the Boolean true and false signals. Basically if we had a PWM-LOAD node that could work with a flip-flop node that could turn the PWM signal off and on like a relay it would make things so much easier. I find that once the PWM-LOAD is activated the flip-flop node doesn’t interact with it anymore and its becomes impossible to turn the PWM signal off with the false boolean. Whats the point in that? Can we please get a node that can turn a PWM signal off and on by a true or false boolean.

Does this patch give you the functionality you need?
flip-flop-pwm-load

PWM duty cycle is set to zero (full off) on FALSE.

No because I want to be able to change settings of the pwm signal via a button

Edit: Well actually it might work. I’ll have to mess with it tonight and see when I can get the chance to test it out. In theory this exactly what I was asking for so it should work. Thanks.

Edit 2: Is it possible for xod to make a node to kill the pwm signal completely based on a true and false boolean? I would rather have that because a pwm signal of “0” is still a pwm signal and it would be more versatile if we could kill the signal completely. It would make it able for me to switch between two different potentiometers on the same pin out.

I think the only way to disable PWM is to use digital-write to write 0 to the pin, but pwm-write with 0 DUTY should do the same thing. Even if the pin is configured for PWM, a DUTY of 0 never sends any pulses.

That being said, it sounds like you are trying to use 2 different potentiometers to write to 2 different pwm-write nodes writing to the same pin. The better solution is probably to use only 1 pwm-write node and feed the value from a select node (or if-else node) that allows you to select which potentiometer value to send to the pwm node.

image

As long as if-else-COND pin is false, pwm-write will use pot2 value. If if-else-COND is changed to true, then pot1 value will be used.

If you cannot reduce your code to use just one pwm-write node (i.e. the node is within a patch that is included in multiple places), then you will need to manage the UPD pin instead of just setting it to Loop so that only one node is updating at any time. You shouldn’t need to “disable” PWM at any time, since disabling all other pwm-write nodes and setting DUTY with just one node will cause that pin to forget any previous values and just use the new DUTY value. In practice, this means you will need to send a pulse to the UPD pin of the pwm-write node that should be setting the value. How you send that pulse will depend on what you are coding. If you have multiple pwm-write nodes for the same pin connected to potentiometers that could change at any time, then just using pulse-on-change probably will NOT work since multiple pwm-write nodes will keep trying to update the same pin. You might use an act node to send the pulse to pwm-write since it would allow you to disable all but one data-path (it combines pulse-on-change with a gate node to block pulse if disabled).

image

You will need to send “true” value to the act-ACT pin to enable this pwm-write node. No matter how many pwm-write nodes write to the same pin, only one should be active at a time.

1 Like

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