Results 1 to 3 of 3

Thread: LINK/ANTILINK (Selector)

  1. #1
    Newbie
    Join Date
    May 2006
    Posts
    8

    LINK/ANTILINK (Selector)

    I apologize if this is simple to do but I'm having a little trouble with it. Basically, I want a selector to choose between 4 fan settings (Off, Low, Med, High). I tried doing this with variables and logic, but I'm having a few issues.

    I have 3 button images and 3 digital outputs corresponding to the 3 speeds. The button images set to trigger output works fine. Trying to have the button images change variables can work, but if I do it this way, the button images do not reflect the status changes in the outputs. Also, I can't seem to get more than one THEN statement to fire per each function. For example:

    If(fan_var == 1){
    fan_low = on;
    fan_med = off;
    fan_high = off;
    }

    This won't work for me. It will only trigger the first statement. I have to set it up like:

    if(fan_var == 1){
    fan_low = on;
    }
    if(fan_var == 1){
    fan_med = off;
    }
    if(fan_var == 1){
    fan_high = off;
    }

    Doing it this way, the button images won't change with the outputs. I have tried doing it with just boolean logic based on the outputs, like:

    if(fan_low == true){
    fan_med = false;
    }

    if(fan_low == true){
    fan_high = false;
    }

    The button images seem to work this way, but the issue here is that it doesn't like it when the state changes because the next setting will be true before the previous setting is turned off.

    Anyway, sorry if this is confusing. Basically, I'm looking for a break-before-make selector where the button images (primary/secondary) will reflect the changes made to their respective digital outputs. Like:

    //if off, turn others off, then turn on
    if(fan_low.downclick == true && fan_low.output == false){
    fan_med.output = false;
    fan_med.display_button = secondary;
    fan_high.output = false
    fan_high.display_button = secondary;
    fan_low.output = true;
    fan_low.display_button = primary;
    }

    //if on, turn off
    if(fan_low.downclick == true && fan_low.output == true){
    fan_low.output = false;
    fan_low.display_button = secondary;
    }

    Thanks for any help or insight you guys can bring.

  2. #2
    FLAC
    Join Date
    Oct 2006
    Location
    Las Vegas
    Posts
    1,286
    I've had similar problems with multiple then statements. You're looking for 'radio button' type of operation. It can be done currently, but it's not as pretty as it could be. I'll look for what I have (related) tomorrow, when I have more time. I remember not using boolean variables, I used numeric ones, and I think I set variables in the loop and not in the 'then' statement. Like I said, I'll check tomorrow. I'm sure the multiple then statement thing will get sorted out, I just wanted to confirm you're on the right track with your thinking. I think I reported this as a bug, but I'll check that thread.

  3. #3
    Newbie
    Join Date
    May 2006
    Posts
    8
    I got a little closer by doing it like this:

    fanlow_button.downclick: fan_var = 1
    fanlow_button.upclick: fanlow_output = ON

    fanmed_button.downclick: fan_var = 2
    fanmed_button.upclick: fanmed_output = ON

    fanhigh_button.downclick: fan_var = 3
    fanhigh_button.upclick: fanhigh_output = ON

    if(fan_var != 1){
    fanlow_output = OFF
    }

    if(fan_var != 2){
    fanmed_output = OFF
    }

    if(fan_var != 3){
    fanhigh_output = OFF
    }

    The downclick on each button will change the fan_var which will then turn off whichever output was on before the upclick turns the output on. The only issue here is that the button image will still not match the output. I think the primary/secondary is only tied to the downclick side of the button image. If I have the downclick trigger the output, then using a function to trigger the output will cause the image to change but then I won't be able to OFF the other outputs.

    Thanks again for your help.

Similar Threads

  1. Audio Selector?
    By ClubFed11 in forum Car Audio
    Replies: 6
    Last Post: 01-14-2006, 12:14 PM
  2. Automatic audio selector?
    By Optimizer in forum Car Audio
    Replies: 0
    Last Post: 01-09-2006, 08:36 AM
  3. Replies: 6
    Last Post: 03-15-2005, 01:07 PM
  4. WTB: Sony XA-300 Aux Input Selector
    By hd54321 in forum Classified Archive
    Replies: 2
    Last Post: 12-02-2004, 12:38 PM
  5. Creative PC-DVD + Remote Selector
    By Micahb in forum General MP3Car Discussion
    Replies: 3
    Last Post: 12-11-2002, 10:01 PM

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
  •