Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > General Hardware Discussion > Fusion Brain > FB Software


Reply
 
Share Thread Tools Display Modes
Old 09-07-2008, 12:50 AM   #1
Newbie
 
Join Date: May 2006
Posts: 7
cambre is on a distinguished road
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.
cambre is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 09-08-2008, 01:16 AM   #2
FLAC
 
Join Date: Oct 2006
Location: Las Vegas
Posts: 1,283
h3rk will become famous soon enough
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.
h3rk is offline   Reply With Quote
Old 09-10-2008, 03:22 PM   #3
Newbie
 
Join Date: May 2006
Posts: 7
cambre is on a distinguished road
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.
cambre is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Selector? ClubFed11 Car Audio 6 01-14-2006 12:14 PM
Automatic audio selector? Optimizer Car Audio 0 01-09-2006 08:36 AM
Help in designing an input selector switch bcw55 Newbie 6 03-15-2005 01:07 PM
WTB: Sony XA-300 Aux Input Selector hd54321 Classified Archive 2 12-02-2004 12:38 PM
Creative PC-DVD + Remote Selector Micahb General MP3Car Discussion 3 12-11-2002 10:01 PM



All times are GMT -5. The time now is 04:52 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics