Go to Post I'm looking forward to January when things will slow down some! - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2005, 18:53
doyler doyler is offline
Rookie / Programmer
#0900 (Infinity)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Durham
Posts: 87
doyler is an unknown quantity at this point
Double Solenoid Help

We have a double solenoid hooked up to a piston
It is hooked up to relays 1 and 2
We are trying to make it come out when the trigger is pulled and go back when it is pulled again

What would I have to fix here?

Code:
int pnu = 0;
...........
       if(p3_sw_trig==1 && pnu==0)
	{
	relay1_fwd=0;
	relay1_rev=1;
	relay2_fwd=1;
	relay2_rev=0;
	pnu+=1;
	}

	if(p3_sw_trig==1 && pnu==1)
	{
	relay1_fwd=1;
	relay1_rev=0;
	relay2_fwd=0;
	relay2_rev=1;
	pnu=0;
	}
__________________
  #2   Spotlight this post!  
Unread 18-02-2005, 19:07
whakojacko's Avatar
whakojacko whakojacko is offline
Registered User
FRC #1072 (hrt)
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2003
Location: San Jose, California
Posts: 137
whakojacko is on a distinguished road
Send a message via AIM to whakojacko Send a message via MSN to whakojacko
Re: Double Solenoid Help

Only have taken a quick glance at your code, but you can wire a double solenoid unsing just 1 spike. Look at the spike manual on ifirobotics.com to find otu how to wire. At will also make your code a bit easier
__________________
Harker Robotics:1072
http://www.harker-robotics.org
  #3   Spotlight this post!  
Unread 18-02-2005, 19:21
doyler doyler is offline
Rookie / Programmer
#0900 (Infinity)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Durham
Posts: 87
doyler is an unknown quantity at this point
Re: Double Solenoid Help

We don't really have time to put a double on 1 spike, but is there a way to fix my code?
__________________
  #4   Spotlight this post!  
Unread 18-02-2005, 23:12
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Double Solenoid Help

To fix your code, you also need to make sure that you only process the change once each time the switch is activated.
Code:
  last_trig = 0;
  ...
  if (p3_sw_trig ==1 && last_trig == 0 && pnu == 0)
  {
    ...
    pnu += 1;
  }
  if (p3_sw_trig == 1 && last_trig == 0 && pnu == 1)
  {
    ...
    pnu = 0;
  }
  last_trig = p3_sw_trig;
  #5   Spotlight this post!  
Unread 19-02-2005, 11:36
doyler doyler is offline
Rookie / Programmer
#0900 (Infinity)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Durham
Posts: 87
doyler is an unknown quantity at this point
Re: Double Solenoid Help

I added that, but for some reason I still can't get it working
__________________
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Single vs double solenoid valve operation Scott358 Pneumatics 0 29-01-2005 11:47
Creating no pressure with double solenoid? Combat Chuck Pneumatics 7 29-02-2004 22:45
Double Solenoid Leak Darksun Pneumatics 4 18-02-2004 22:52
using single solenoid like a double SteveO Programming 14 02-02-2004 22:51
Anyone willing to trade (something they need) for the SMC double solenoid? Jeremy Kit & Additional Hardware 0 27-01-2004 20:14


All times are GMT -5. The time now is 00:16.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi