Shop OBEX P1 Docs P2 Docs Learn Events
Need help 'toggling' x10 scenario using UNITON and XOR — Parallax Forums

Need help 'toggling' x10 scenario using UNITON and XOR

GerryLGerryL Posts: 7
edited 2007-01-21 16:21 in BASIC Stamp
I'm putting together a custom controller for X10 here in my house.· In reading the manual there is a blurb about toggling, but not enough info for me to understand.· I'd like to push a button (I'm bringing an input high) to turn on 3 units on my house code.· I'd then like to push it again to turn them off.· Can anyone point me in the direction of a project or tutorial that will explain how this can be achieved?
Thanks!
-Gerry
·

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-01-21 16:21
    Gerry: -

    I think I understand what you want to do. If you want to "toggle" a bit, you can use the Exclusive OR function as follows:

    FLAG VAR BIT
    FLAG = 0

    Main:

    On FLAG (Flag_Off, Flag_On)

    Flag_Off:

    FLAG = FLAG | %1 ' Set Flag ON by toggling it

    GOTO ...

    Flag_On:

    FLAG = FLAG | %1 'Set FLAG OFF by togggling it

    GOTO ...


    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
Sign In or Register to comment.