View Single Post
  #3   Spotlight this post!  
Unread 10-02-2005, 02:42
Bleric's Avatar
Bleric Bleric is offline
Registered User
#0624 (CRyptonite)
Team Role: Programmer
 
Join Date: Jan 2005
Location: Houston
Posts: 19
Bleric is on a distinguished road
Send a message via AIM to Bleric Send a message via MSN to Bleric
Re: One button wonder

You want to switch the solonoids once, then skip over the code each following loop, untill you let go of the trigger and push it down again, right?

Our team is doing exactly that with our pneumatics. Here's how we're doing it. (blatantly stolen from the v2.4 default code )

Code:
//somewhere at the top of user_routines.c
        int latch = 0;
//somewhere in default_routine()
	if(p1_sw_trig)
	{
		latch++;
		if(latch==1)
		{
			relay1_fwd=!relay1_fwd;
			relay1_rev=!relay1_fwd;
		}
		latch=1;
	}
	else
	{
		relay1_fwd=relay1_rev=0;
		latch=0;
	}
Works pretty good for us.