|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
I need a button code for operating our arm on our robot. Any code would be nice.
Thank you.P.S.- We have a single joystick code, if that matters at all. |
|
#2
|
|||||
|
|||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
Quote:
What button are you using? What do you want to have happen when you press the button? The code you want has to implement that. After you give some real specifications for what you want, we can start giving useful suggestions on how to meet them. |
|
#3
|
||||
|
||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
Alrgiht, we have a pneumatic arm with three different cylinders, one for lifting, and two for extension. We need code to operate these three cylinders with one joystick, so we can have another for driving. We need three different buttons to operate each cylinder, the first press to activate the cylinder out, and the second press of the same button to retract it.
Last edited by willie837 : 11-02-2005 at 16:22. |
|
#4
|
||||
|
||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
Check out this thread.
What you're looking for is a way to toggle a relay output with a button tap. There were several solutions mentioned. |
|
#5
|
||||
|
||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
The code we saw is not working. Where in the Default Code do we put it? Or what is another code?
|
|
#6
|
|||||
|
|||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
Quote:
In the Default_Routine() function in user_routines.c, use this code: Code:
static char last_trig = 0; // this is what the switch state was last time
static char cylinder_state = 0; // this is what we last told the cylinder
if (last_trig == 0 && p4_sw_trig == 1) // the switch was just now pressed
{
if (cylinder_state == 0) // the cylinder was retracted, need to extend
{
cylinder_state = 1; // remember that we're extending it
relay1_fwd = 1; // do whatever it takes to activate the solenoid
relay1_rev = 0;
}
else // the cylinder was extended, need to retract
{
cylinder_state = 0; // remember that we're retracting it
relay1_fwd = 0; // do whatever it takes to reverse the solenoid
relay1_rev = 1;
}
}
last_trig = p4_sw_trig;
|
|
#7
|
||||
|
||||
|
Re: Need Serious Gimungous Huge Major Seriously Awesome Help
Thanks. I think we are going to use the trigger, left hand button on the top, and thumb button.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|