Problems with Triggers


#1

1) Give a description of the problem
I have a very simple piston for toggling the TV and fan on/off on the push of a button based on if the fan/TV are already on.

2) What is the expected behavior?
On one press it should turn the fan off if it is on. On another press it should turn the fan on if it is off.

3) What is happening/not happening?
The trigger is staying “True” for too long. My understanding was that “because 2 [triggers] can never be simultaneously true.” But it runs the first IF when the button is pushed and the fan is on, and turns it off, then the fan being off matches the second criteria but the button pushed is still true so it runs the second IF too turning the fan back on.

4) Post a Green Snapshot of the pistonimage


#2

Adding a loop stopper variable seems to be working sometimes.


#3

Line 20 and 32 are identical triggers. I would combine the logic in both of those blocks into one slightly larger block. Something like this:

IF button gets pushed
Then
    IF All switches are on
    Then
        Turn off Fan
    Else
        Turn on TV and Fan
    END IF
END IF

If button gets held
Then
    Turn off TV and Fan
END IF

(no async’s or variables required with this method)


#4

This is the same issue I’m having with a Button and Lights: