Go to Post Through 30 years of teaching I've heard the same refrain..."I love science, I love math but I can't stand my language classes". Well enough is enough. Get over it. - Mr.B [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-01-2002, 17:20
zorro zorro is offline
Registered User
#0292 (PantherTech)
 
Join Date: Jan 2002
Location: Kokomo, IN
Posts: 21
zorro is an unknown quantity at this point
Send a message via AIM to zorro
Auto Air Pump Code

I have seen a lot of auto air pump code out there that is longer and more sophisticated than it should be. I wrote the following code to accomplish the same task but it uses less lines of code and less IF statements. Yes, it includes a delay on turning off the pump.

Just copy and paste the following:

'=============================================
' Auto Air Pump Sub
'=============================================

' pressure is an alias for the pressure sensor
' pressure = 0 when tank is full
' pressure = 1 when tank is empty

' pump is an alias for the relay output to the pump
' When pump=1 the compressor is on.

' num_loops is a byte variable that counts loops until...
' pump_delay which is a constant for the number of loops
' to run the pressure switch after it has been
' toggled

' This code is written as a subroutine. Place the code
' after the main loop and call it by typing:
' "gosub subAutoAirPump" in the main loop

subAutoAirPump:
if (pressure = 0) then pump_check
num_loops = 0
pump = 1
return

pump_check:
if (num_loops = pump_delay) then pump_off
pump = 1
num_loops = num_loops + 1
return

pump_off:
pump = 0
return

' END CODE


Reply if you have any questions.

Greg Szorc

Last edited by zorro : 10-01-2002 at 17:23.
 


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
Does your team use the Default code. Jeff McCune General Forum 2 09-01-2003 14:46
What are pneumatics? Aignam Pneumatics 23 16-10-2002 21:17
Need help with 255 Variable Joseph F Programming 18 26-02-2002 14:49
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46
Pneumatics pump allowed on robot? bigqueue Pneumatics 5 06-01-2002 12:30


All times are GMT -5. The time now is 12:25.

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