OR node beginner problems

Here is the part of my program and the OR node does not work.
Hopefully you can help me or am I too stupid.

Thank you very much for helping a beginner.
Best regards, Torsten.

What “doesn’t work”? If output of timer is false or flip-flop has been set, output of ‘or’ will be True. flip-flop is never reset, so once set, it will always be true.

1 Like

It also will not work if I remove the flip flop and connect the button node directly to the OR node.

I really have no clue.

If I remove the right handed connection to the OR node the timer sequence is running normally and the relay is triggered well. But when I make a connection to both inputs of the OR node… nothing will work, neither the timer sequence will trigger the relay.

Thanks a lot for help.

P.S.: I’ve tried it on different boards also (Uno, Mega and Leonardo)

When you connect the 2nd input, the relay never turns on, or never turns off? “will not work” is not very helpful. To be of much help, we need to know what you are expecting it to do, and what it is doing instead.

You can add ‘watch’ nodes and run in debug mode to see if outputs are what you think they should be.

1 Like

Sorry for not beeing precise enough.

When the 2nd line (push button)is connected to the OR node nothing happens. The relay is not switched on any more.

And also when I’m starting the flipping sequence the relay does nothing, it is always off.

Thanks in advance for any hint.

P.S.: End result should be… when the flipping sequence is over, the relay should bei manually turned on and off by the push button.

If you want button to turn relay on and off, then button should link to flip-flop-TGL, not flip-flop-SET.

‘or’ behavior seems very strange. If you just delete the wire between flip-flop & or, it works as expected when timer is running, but adding that wire the relay never turns on?

What node are you using for Timer so we can re-create? Or better yet, please attach a xodball of your project so we can see if surrounding code might be affecting this (like a 2nd copy of relay node using the same port)

1 Like

Hi there,

I’m not allowed to upload xodball here because I’m new.

Can I send the file via E-Mail to you?

This is the whole setup.
The input part (potentiometers and buttons) and the display part is working well.

By the way the community is awesome… thanks for all the help and patience.

Can you upload code now?

Wendesteuerung_2.xodball (16.3 KB)

Yesssssss, it worked.

By the way this should be a new control unit for a our bow and crossbow range.
It should show and hide targets for speed shooting.

flip-n-times-ACT is a boolean value. button-UPD is a pulse, so it will only read the button when timer becomes active. I assume this is not what you really want. If you want the button active while timer is running, you could connect flip-n-times-ACT to continuously-pausable-EN and link continusouly-pausable-TICK to button-UPD. If you want button enabled when timer is NOT active, simply add ‘not’ node between flip-n-times and continuously-pausable. You will have the same problem with your Reset Taster button…it will only be read when read of Start Taster button completes. It won’t hurt to reset when flip-n-times is NOT active, so you may a well just make this button UPD in Loop.

You mentioned before that you want button to manually turn relay on/off, so button needs to connect to flip-flop-TGL, not flip-flop-SET.

From what I see, relay should be on when timer is not active. It will be on/off while timer is running if flip-flop is false. If you are holding Manuell button when timer goes active, it will set the flip-flop & turn relay on with no way to turn it back off.

Sort of unexpected…looks like flip-n-times starts out active on boot. I’ve replaced your hardware with tweak & watch nodes so I could debug without building out a board, and it seems to work for me. I have changed it so that flip-n-times resets on boot or button press.

I have seen issues in the past with timer conflicts, but you are only using 1 timer. The problem doesn’t usually show up unless you are running servos or PWM along with delays/timers/etc.

With my tweak code, relay starts on (because flip-n-times is not active, so OUT is false and gets negated by ‘not’). Since relay is already true, Manuell button does nothing; it can only keep relay on when timer is trying to turn it off. My guess would be that you want to remove the ‘not’ if timer starts out inactive, or you might want to move the ‘not’ after the ‘or’ (i.e. if target moves out when relay is off & you want target hidden most of the time unless timer is running or you have turned on the flip-flip). Another option would be to replace the ‘or’ with an ‘and’ so relay only turns on when both inputs are true (not likely in this case, but maybe…). It depends on what you want functionality to be.

Wendesteuerung_tweak.xodball (17.8 KB)

Maybe your code is working different for you, or replacing hardware with tweak changes how it works. If your code is actually working, my best-guess would be that flip-n-times is starting active & you have a long Ton, so you never see the relay turn on (but flip-flop should turn it on if you push Manuell button, so maybe something else is happening)

Let me know how my version of the code works for you. To simulate a button press, run in debug mode, select the tweak-pulse “button” that you want to press, then click “pulse” button in left pain where you would normally enter input values for nodes. If this works, maybe you can merge my changes into your code. If it breaks when you add the hardware, there is a slim chance you are hitting a bug in XOD, but it is more likely that your button is not working correctly… You can add another watch node on button-PRS to verify it is working.