Go to Post Being rude is easy. Being a compassionate human being takes work. - Joe Johnson [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 02-07-2013, 09:11 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Programming Pneumatics

Logically, sort of. First, try to put your code into code blocks. It makes your code look nice :P They look like [code ] put your code here [/code ] without the spaces after them. Follow the above suggestions as well.
Code:
            else
            {
                piston1extract.set (false);
                piston1retract.set (false);
                piston2extract.set (false);
                piston2retract.set (false);
            }
The above code has a logic error. When not in operation, the pneumatic cylinder should be retracted, so the solenoid that is connected to the forward most valve on the cylinder (the one closest to the functioning end) is enabled while the other is disabled. The code should look sort of like this (which is C++)
Code:
else
{
        Reverse2->Set(1);
	Reverse->Set(1);
        Forward2->Set(0);
	Forward->Set(0);
}
Here's some pseudo code / C++ that demonstrates some basic logic:
Code:
if (Button1)
{
	Forward->Set(1);
	Reverse->Set(0);
	Wait(0.1);
}
else if (!Button1)
{
        Forward->Set(0);
	Reverse->Set(1);
	Wait(0.1);

}
It's pretty much the same for both languages

Last edited by ekapalka : 02-07-2013 at 09:16 PM.
Reply With Quote
 


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


All times are GMT -5. The time now is 07:41 AM.

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