ideasman Posted June 6, 2009 Share Posted June 6, 2009 Hi At the moment I have two channels one and two. I cant get the 2 to toggle on a button component. This is a custom protocol as two separate switch's are working to confirm they work.Channel one is "on" and Channel "two" is off via a user defined protocol. Ive forgot how to toggle them with the toggle action in the button? can someone help. Cheers Ideasman Link to comment Share on other sites More sharing options...
AzeoTech Posted June 8, 2009 Share Posted June 8, 2009 There's a Toggle Between action, or you can do it in script: mychannel = !mychannel[0] if you are trying to have one on while the other is off, you probably should use an if: if (chan1[0]) chan1 = 0 chan2 = 1 else chan1 = 1 chan2 = 0 endif Link to comment Share on other sites More sharing options...
ideasman Posted June 8, 2009 Author Share Posted June 8, 2009 The code is not doing as expected. chan1 sends "110" and chan2 sends "210" from a user defined protocol. It is sending 110 but not "210" of the second channel. this is the quick sequence as follows if (six1[0]) six1 = 1 'Chan1 six2 = 0 'Chan2 else six1 = 0 six2 = 1 endif Cheers ideasman Link to comment Share on other sites More sharing options...
ideasman Posted June 8, 2009 Author Share Posted June 8, 2009 Sorry to add to the other email the code is sending the on and off together after watching the monitor function. Toggle not happening. thanks Ideasman Link to comment Share on other sites More sharing options...
AzeoTech Posted June 9, 2009 Share Posted June 9, 2009 OK, first, I assume by 'Chan1, you meant // chan1. The double slash // is the comment, not '. I know ' is comment for some language, but I've forgotten which, VB maybe? // follows C. Anyhow, so, is this one output, and six1 turns it on, six2 turns it off? If so, then you want: if (six1.time[0] > six2.time[0]) six2 = 1 else six1 = 1 endif I'm using the time of the last setting to determine what the current state it. Is would be better if you had some feedback input channel for this. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.