Branch - Do I understand it wrongly?

I’m trying to get two LED’s to work alternatively ( when Blue is ON, Red is OFF, when Blue comes ON again RED is OFF )

I used Branch for it and I don’t understand why Blue LED do not go OFF

If I understand BRANCH NODE correctly what should happen here is:
Square Generator set to 2 sec with Duty time 1sec sould every one second change state from true to false at OUT this signal delivered to BRANCH GATE input should change Branch outputs and deliver TRIG signal once to the left hand side LED Line, once to the right hand side LED Line.

Correct?

If Yes, Why BLUE LED is constantly ON

If No, please explain me what I made wrong.

Here is a simpler version of what you are trying to achieve.

1 Like

Setting a pulse pin to loop will cause it to constantly pulse, so you will not get a single pulse to turn LED on/off. Since the pulse feeds toggle, it will “randomly” keep switching very quickly on and off (if it does anything at all… Loop may not do anything in this case…).

This is a poor use case for branch. You want a signal to turn blue on or off. This could be output from square-wave, or flip-flop. If you want red to always be the opposite, use “not” of the same value used to control blue.

Branch is usually used when you are using pulses to control which part of the program is “active”. The traffic light example under case studies on the XOD documentation page is a good intro for doing that.

1 Like

That’s the case, I would like to build longest sequences - program parts ( this LED’s has been use just as proof of concept ) Finally to make sure I do understand how branch works: Pulse delivered to the TRIG will be redirected to Outputs T or F depend from Boolean state at the GATE input. Right?
I understood why this loop present on TRIG at the moment make troubles.

Thanks it works as expected in LED Case is perfect. Thanks for that.

That is how pulse works. Usually TRIG would be a previous part of the program finishing (in the traffic light example, it is the delay timer DONE signal indicating another light had turned off). Branch can then be used to decide which light should now turn on (or other action to be taken).

1 Like

Thanks a lot for information’s.

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