Results 1 to 7 of 7

Thread: Push button on/off

  1. #1
    New User
    Join Date
    Nov 2015
    Location
    Virginia
    Posts
    4

    Question Push button on/off

    I saw the sticky about "AND", but I don't know if that will work here... I have a push button on a breakout box and all I'm trying to do is:

    Code:
    [V_Outlet1]
    IF Sw1 CLOSED AND OUTLET V_Outlet1 = OFF THEN ON
    IF Sw1 CLOSED AND OUTLET V_Outlet1 = ON THEN OFF
    In other words, every time you press the button, I want the state to change from off to on or from on to off.

    How can I do that?

    Thanks

  2. #2
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    13,176
    You need 3 VOs to do this

    Toggle
    If Output ToggleSet = ON Then ON
    If Output ToggleRst = ON Then OFF

    ToggleSet
    Set OFF
    If Switchname CLOSED Then ON
    If Output Toggle = ON Then OFF
    Defer 000:05 Then OFF

    ToggleRst
    Set OFF
    If Switchname CLOSED Then ON
    If Output Toggle = OFF Then OFF
    Defer 000:05 Then OFF

    Sent from my SM-G965U using Tapatalk

  3. #3
    New User
    Join Date
    Nov 2015
    Location
    Virginia
    Posts
    4
    Quote Originally Posted by zombie View Post
    You need 3 VOs to do this

    Toggle
    If Output ToggleSet = ON Then ON
    If Output ToggleRst = ON Then OFF

    ToggleSet
    Set OFF
    If Switchname CLOSED Then ON
    If Output Toggle = ON Then OFF
    Defer 000:05 Then OFF

    ToggleRst
    Set OFF
    If Switchname CLOSED Then ON
    If Output Toggle = OFF Then OFF
    Defer 000:05 Then OFF

    Sent from my SM-G965U using Tapatalk
    Thanks! I'm trying to wrap my head around it... When you press the button, both ToggleSet and ToggleRst are ON which I guess would turn Toggle ON, at least until next instruction is read. That makes my brain hurt. When are we going to get AND/OR? Lol

    Thanks

  4. #4
    New User
    Join Date
    Nov 2015
    Location
    Virginia
    Posts
    4
    Wait though, that's not working for me... the button press set SilentMode ON but other presses don't set it to OFF...

    Here's my code:

    [SilentMode]
    If Output SilentTogSet = ON Then ON
    If Output SilentTogRst = ON Then OFF

    [SilentTogSet]
    Set OFF
    If Sw5 CLOSED Then ON
    If Output SilentMode = ON Then OFF
    Defer 000:05 Then OFF

    [SilentTogRst]
    Set OFF
    If Sw5 CLOSED Then ON
    If Output SilentMode = OFF Then OFF
    Defer 000:05 Then OFF

  5. #5
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    13,176
    Make sure you wait at least 5 seconds between presses.

    Sent from my SM-G965U using Tapatalk

  6. #6
    New User
    Join Date
    Nov 2015
    Location
    Virginia
    Posts
    4
    Yeah, the skimmer plugged into the outlet kind of hitches a couple times and it stays on. Maybe it's some kind of bounce problem with the switch. Sounds like it wasn't meant to be... I'll pick up some toggle switches and go about it that way. Thanks anyway

  7. #7
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    13,176
    You might need a defer Then ON in the reset now that I think about it. Then you set with a short press and reset with a long press.

    Sent from my SM-G965U using Tapatalk

Similar Threads

  1. Still Lost on Powering Push Button
    By brandonrush1 in forum AquaBus Modules, Probes, and Breakout Boxes
    Replies: 4
    Last Post: 01-08-2019, 12:56
  2. Review My Program Feed Push Button
    By david99 in forum Misc Apex Usage & Programming
    Replies: 15
    Last Post: 08-21-2017, 15:31
  3. Help! Manual Feed Push Button
    By zobby in forum Misc Apex Usage & Programming
    Replies: 5
    Last Post: 01-08-2015, 12:29
  4. Question: Push Button To Toggle Lights
    By billte in forum Apex Programming for Lighting
    Replies: 7
    Last Post: 02-03-2014, 20:58
  5. Question: How to initiate a feed with a Push Button on the Display?
    By mathis in forum Misc Apex Usage & Programming
    Replies: 10
    Last Post: 07-09-2013, 13:18

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •