Go to Post Breathe in and out.... *altoids mint* breathes in more... *looks at countdown until kickoff*...30 DAYS!!! *competition anxiety disorder* - Conor Ryan [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 02-02-2004, 20:29
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
using single solenoid like a double

We're wondering if it is possible to use a single solenoid like a double basically by having to only press a button once instead of holding it down. Tell me if I'm crazy about the solenoid thing, but it seems possible to edit the program so that pressing the thumb or trigger on a joytick (pX_sw_whatever) once will keep the relay attached to its corresponding relay output in forward mode. How would you go about doing this? I think I have an idea, but I am a n00b and don't wanna embarass myself....
  #2   Spotlight this post!  
Unread 02-02-2004, 20:42
Guest
 
Posts: n/a
Re: using single solenoid like a double

Quote:
Originally Posted by SteveO
We're wondering if it is possible to use a single solenoid like a double basically by having to only press a button once instead of holding it down. Tell me if I'm crazy about the solenoid thing, but it seems possible to edit the program so that pressing the thumb or trigger on a joytick (pX_sw_whatever) once will keep the relay attached to its corresponding relay output in forward mode.
The double-solenoid valve works by outputting air into one side of the piston to make it extend. You then set it in reverse (the spike) to put air into the other side of the piston to make it retract. You can't model a double-solenoid using a single-solenoid by changing the software. The purpose of a double-solenoid valve is to be able to actuate the piston in both directions, ONE single solenoid valve cannot do this, but TWO SINGLE solenoid valves can

Last edited by SilverStar : 02-02-2004 at 21:15. Reason: misspelling and wrong words
  #3   Spotlight this post!  
Unread 02-02-2004, 20:50
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
Re: using single solenoid like a double

Quote:
Originally Posted by SilverStar
The double-solenoid valve works by outputting air into one side of the piston to make it extract. You then set it in reverse (the spike) to put air into the other side of the piston to make it extract. You can't model a double-solenoid using a single-solenoid by changing the software. The purpose of a double-solenoid valve is to be able to actuate the piston in both directions, ONE single solenoid valve cannot do this, but TWO SINGLE solenoid valves can
Ok so I am indeed crazy about the solenoid thing, but can anyone help me out with a way to keep the relay forward while only pressing the button once instead of holding it down?
  #4   Spotlight this post!  
Unread 02-02-2004, 21:14
Guest
 
Posts: n/a
Re: using single solenoid like a double

Sure, the "toggle" code you need is at the repository:

http://nrg.chaosnet.org/repository/viewcode?id=23
  #5   Spotlight this post!  
Unread 02-02-2004, 21:15
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: using single solenoid like a double

if you mean you want to use two buttons like "on" and "off" buttons, here's one way to do it:

Code:
static char btn_status = 0;

if(p1_sw_aux1) btn_status = 1;
if(p1_sw_aux2) btn_status = 0;

relay1_fwd = btn_status;
basically, just declare a static variable (so that it holds its state), then use the input from the buttons to set the variable at the appropriate times. (note - some of the input variable names may be off, i'm doing this from memory only)
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #6   Spotlight this post!  
Unread 02-02-2004, 21:17
Guest
 
Posts: n/a
Re: using single solenoid like a double

Quote:
Originally Posted by deltacoder1020
if you mean you want to use two buttons like "on" and "off" buttons, here's one way to do it:

Code:
static char btn_status = 0;

if(p1_sw_aux1) btn_status = 1;
if(p1_sw_aux2) btn_status = 0;

relay1_fwd = btn_status;
basically, just declare a static variable (so that it holds its state), then use the input from the buttons to set the variable at the appropriate times. (note - some of the input variable names may be off, i'm doing this from memory only)
The code needs to be made slightly more complex because, as I interpret it, SteveO wants one button to toggle, my code above solves that.
  #7   Spotlight this post!  
Unread 02-02-2004, 21:21
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: using single solenoid like a double

either way you want to work it.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #8   Spotlight this post!  
Unread 02-02-2004, 21:33
velocipenguin velocipenguin is offline
Registered User
#0246 (Overclocked)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Boston, MA
Posts: 77
velocipenguin is on a distinguished road
Send a message via AIM to velocipenguin
Re: using single solenoid like a double

Couldn't you do it with a simple XOR operation?

i.e.
Code:
relay1_fwd ^= p1_sw_trig;
  #9   Spotlight this post!  
Unread 02-02-2004, 21:38
Guest
 
Posts: n/a
Re: using single solenoid like a double

No, because the p1_sw_trig will remain true for more than one frame (unless your driver moves faster than light ). Thus, relay1_fwd would continuously switch from 0 to 1.
  #10   Spotlight this post!  
Unread 02-02-2004, 21:57
velocipenguin velocipenguin is offline
Registered User
#0246 (Overclocked)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Boston, MA
Posts: 77
velocipenguin is on a distinguished road
Send a message via AIM to velocipenguin
Re: using single solenoid like a double

Quote:
Originally Posted by SilverStar
No, because the p1_sw_trig will remain true for more than one frame (unless your driver moves faster than light ). Thus, relay1_fwd would continuously switch from 0 to 1.
Good point.
  #11   Spotlight this post!  
Unread 02-02-2004, 21:59
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
Re: using single solenoid like a double

ahhh merci SilverStar, I was thinking of using something similar with even or odd number of times pressing the button, this works
  #12   Spotlight this post!  
Unread 02-02-2004, 22:10
velocipenguin velocipenguin is offline
Registered User
#0246 (Overclocked)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Boston, MA
Posts: 77
velocipenguin is on a distinguished road
Send a message via AIM to velocipenguin
Re: using single solenoid like a double

If you do it this way, it should only toggle the relay output when the button transitions from one state to another. That should eliminate the problem of infinite toggling that was present in my last suggestion.

Code:
// declare this as a global variable
bool LastButtonValue=0;

// place the following within the main loop
if(p1_sw_trig!=LastButtonValue)
        relay1_fwd ^= p1_sw_trig;

LastButtonValue = p1_sw_trig;
  #13   Spotlight this post!  
Unread 02-02-2004, 22:42
Guest
 
Posts: n/a
Angry Re: using single solenoid like a double

Quote:
Originally Posted by velocipenguin
If you do it this way, it should only toggle the relay output when the button transitions from one state to another. That should eliminate the problem of infinite toggling that was present in my last suggestion.

Code:
// declare this as a global variable
bool LastButtonValue=0;
 
// place the following within the main loop
if(p1_sw_trig!=LastButtonValue)
relay1_fwd ^= p1_sw_trig;
 
LastButtonValue = p1_sw_trig;
umm... that's exactly what's in the repository link above .....
  #14   Spotlight this post!  
Unread 02-02-2004, 22:49
velocipenguin velocipenguin is offline
Registered User
#0246 (Overclocked)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Boston, MA
Posts: 77
velocipenguin is on a distinguished road
Send a message via AIM to velocipenguin
Re: using single solenoid like a double

It's a little more concise, but yeah, you're right. I shouldn't attempt to think when I haven't slept much - this is what happens. Sorry.
  #15   Spotlight this post!  
Unread 02-02-2004, 22:51
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: using single solenoid like a double

nothing really to be sorry about - posting the code here doesn't hurt.

also, instead of a global variable, i'd recommend a static - that way, you don't have any possible variable conflicts.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
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
Anyone willing to trade (something they need) for the SMC double solenoid? Jeremy Kit & Additional Hardware 0 27-01-2004 20:14
multiple cyclinders from one double solenoid Ed Crammond Pneumatics 1 07-02-2003 18:49
double solenoid gail OCCRA 0 11-10-2002 19:42
Will trade for double solenoid valve archiver 2001 2 24-06-2002 00:33
Single Solenoid Valve SMC Chubtoad Technical Discussion 3 20-01-2002 15:16


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

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