Go to Post It is crucial to keep experience and keeping collected under pressure as high points that can't be measured in a test. - jnelly [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-2007, 03:18
Asheron Asheron is offline
Registered User
no team
 
Join Date: Jan 2007
Location: New Orleans
Posts: 13
Asheron is an unknown quantity at this point
Need pnuematics Idea Critique please help!

I'm using EasyC.

I was thinking of controlling the soleniods in the following manner (and this is psuedocode)

Setup info: I have a global button_counter(1) integer that keeps track of how many times a button has been pressed on the joystick, and I have a relay, and I have a button(1) variable that holds input from one of the joystick buttons. The example uses 'button1' and 'button_counter1' but could work for buttons 1 through for 4 to control seperate soleniods or relay attachments.

If button(1) is pressed
{
button_counter1 ++
// turn on relay in one positive direction

if button_count == 0

{ while (button not pressed again)
{
set relay1(1,0)
}
else if button_count == 1
{ while (button not pressed again)
{ set relay1(0,0) }
}
else if button_count == 2
{ while (button not pressed again)
{ set relay1(0,1) }
}

else { set relay1(0,0); button_count = 0;}

end if
end if

The purpose being to be able to have the flow controlled for each soleniod by only 1 button being pressed. I don't have access to the robot to know exactly how they work. I'm doing this code from remote location and need help as soon as possible. Will this work, if not why not? Please PM me if you have a suggestion.

Also, how do I capture the event of a button press?

I don't know how to set a listener for an OI digital input that could then be the codition for the original if
  #2   Spotlight this post!  
Unread 19-02-2007, 00:01
GuitarManiac511's Avatar
GuitarManiac511 GuitarManiac511 is offline
Programmer
AKA: Joshua Miller
FRC #1959 (Aye Robot)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Columbia, SC
Posts: 3
GuitarManiac511 is an unknown quantity at this point
Send a message via AIM to GuitarManiac511 Send a message via MSN to GuitarManiac511 Send a message via Yahoo to GuitarManiac511
Re: Need pnuematics Idea Critique please help!

To capture the press event, you need one global variable and another var that can be local or global (doesn't matter). For my example, I will use the trigger of joystick on port 3. the [] means to use a block. I may not use the correct names for them, but you should get the gist of it...

Global:
int TrigWas;

Local:
int TrigIs;

...
TrigIs = [IOAnalog(3, 1)];
if (!TrigWas & TrigIs)
{
// Trigger was pressed...
}
TrigWas = TrigIs;
...


As for the rest of the coding, I'm not sure what your trying to do...
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
Need critique of programming idea and info!!! Asheron Pneumatics 2 18-02-2007 11:21
Need Help w/ pnuematics programming idea!!! Asheron Programming 0 18-02-2007 03:17
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 10:59.

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