07-05-2005 05:21 AM - edited 07-05-2005 05:21 AM
Message Edited by Trabuca on 07-05-2005 05:21 AM
07-05-2005 06:59 AM
Ok, lets examine what you are doing vs. what you want to do. You have fed the output of the analog read to the selector of a "0,Default" or "1" case statement. What is going to happen with your case statement. Most of the time it will be in the 0, default state, occasionally (very occasionally, like probably never) it will get exactly 1 out of the analog read and advance to the other case. Additionally you have to wire something to every output of a case statement, even if it is to set it to output the "default" (a bad pratice, good programming requires that you try very hard to know what every output will be). You want the analog read to detect a <or> than your preset values (which don't agree in the program with your written description). You want to move the < OR > out of the case, make it the deciding factor ( > 400 implies that everything else is less than 400) and then you will just have a T/F case. Inside you can wire the booleans to the T/F being passed in, with whatever logic to get the desired "states" for them. The trick, sometimes, is to write down, in simple terms, what you are attempting to do in a part of code, then go through the code, trying to see what will happen at each step.
Keep wiring, keep asking questions. The only truely "dumb" question is the one unasked.
P.M.

07-05-2005 07:26 AM