PDA

View Full Version : Need help 'toggling' x10 scenario using UNITON and XOR



GerryL
01-21-2007, 08:27 PM
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

Bruce Bates
01-21-2007, 11:21 PM
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 -->