Here is my question. We have our robot set up to use one joystick driving, so the motors are wired to pwm13 and pwm15 My question is how would I wire and program a pair of pneumatics cylinders so that if the joystick is in the forward position both fire, if the joystick is in the left position one fires and another doesn’t, and so on. My problem is I understand how to make motors move but don’t understand how to make the cylinders fire based on joystick input. Also I don’t know where I’d have to remap the joystick and where to put the code for the pneumatics. Appreciate any info on this.
if (p3_y > 132) {
relay1_fwd = 1;
relay1_rev = 0;
relay2_fwd = 1;
relay2_rev = 0;
}
if (p3_x > 132) {
relay1_fwd = 1;
relay1_rev = 0;
}
and so on. (And without a little more detail on your “and so on”, I can’t give you any more detail on mine. )
[edit]
Aww, what the heck. I’ll give you a few more details for free.
-
This code could be added to Default_Routine() in user_routines.c. You would probably also want to remove any other code in Default_Routine() that has anything to do with these joystick axes and relays.
-
I don’t know whether you are planning on ever having to retract the cylinders. You said you wanted to “fire” (extend?) two cylinders when the joystick is forward. If, for instance, you want to retract the same two cylinders when the joystick is pulled backwards, you will also need something like:
if (p3_y < 122) {
relay1_fwd = 0;
relay1_rev = 1;
relay2_fwd = 0;
relay2_rev = 1;
}
-
Notice that I’m testing for < 122 and > 132. This gives you a dead band in the middle, so that you don’t get the cylinders firing spuriously (and/or furiously
) because the joystick is not perfectly centered.
-
The last time I checked (last year with the old OIs) the joystick X axis increases to the left, and decreases to the right. That is why I tested for p3_x > 132, and not less than 122.
[/edit]
You sound like you’re having too much fun with this.
we want to extend two cylinders when we push forward on the joystick,
both cylinders to retract when we pull back the joystick,
and one extend and the other retract when we pull the joystick to the side, and when we pull the joystick the otherway, we want the opposite (one extend and the other one retract)
well, anyways. the point of the question is…
we need to figure out how to use the analog part of the joystick to activate the spikes.
it’d really be nice if we could do it on the small 8(?) directional analogish button on the ‘new’ joysticks. the kit ones