|
Re: c debugger
Quote:
|
Originally Posted by stephenthe1
um, would this code cause two pistons to fire assuming they are hooked up to relay 1 and relay2. also, you'll notice in my if statements that I used if its 1, then to execute the stuff, is that the right way of asking if the switch is one, or should I do (p2_sw_trig01), I've seen that but didn't know what it meant. what's the correct way? thanks.
Code:
if (p1_sw_trig = 1) {
relay1_fwd = 1;
relay1_rev = 0;
relay2_fwd = 1;
relay2_rev = 0;
}
if (p1_sw_trig = 0) {
relay1_fwd = 0;
relay1_rev = 0;
relay2_fwd = 0;
relay2_rev = 0;
}
if (p2_sw_trig = 1) {
relay1_fwd = 0;
relay1_rev = 1;
relay2_fwd = 0;
relay2_rev = 1;
}
if (p2_sw_trig = 0) {
relay1_fwd = 0;
relay1_rev = 0;
relay2_fwd = 0;
relay2_rev = 0;
}
|
In the code above, p1_sw_trig is not used (it is irrelevant). What do you want the function to be (in plain language)?
__________________
Mike Betts
Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013
As easy as 355/113...
|