Thread: pressure switch
View Single Post
  #3   Spotlight this post!  
Unread 14-02-2002, 19:37
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Talking

Hey Junkyard, that sounds like an "engineer" answer. I was thinking Pico was looking for a "programmer" answer. (Or maybe he needs an electrical technician's answer.)

In any case, here's my programmer answer:

FIRST gave you two switches this year. They are preset to trigger at two different pressures. If you turn the pump on when the lower pressure switch closes, and turn it off when the high pressure switch opens, you will prevent the pump from cycling excessively (which is what your electrical people want you, the programmer, to do.)

There are other threads that also tell you how to do this, but I will give you my answer here:

Code:
'( Make sure you know which switch is which before you use this code.)
if low_pressure_switch = 0 then DontTurnOn
    ' The low pressure switch is closed, (and the high pressure
    ' switch is assumed to be also) so turn on the compressor.
    pumpRelayOn = 1

DontTurnOn:
if high_pressure_switch = 1 then DontTurnOff
    ' The high pressure switch is open, (and the low pressure
    ' switch is assumed to be also) so turn the compressor off.
    pumpRelayOn = 0

DontTurnOff:
If you don't want to take the trouble to figure out which switch is which, this code should work:
Code:
if (switch1 = 0) or (switch2 = 0) then DontTurnOn
    ' Both of the switches are closed, so turn on the
    ' compressor.
    pumpRelayOn = 1

DontTurnOn:
if (switch1 = 1) or (switch2 = 1) then DontTurnOff
    ' Both of the switches are now open, so turn the
    ' compressor off.
    pumpRelayOn = 0

DontTurnOff:
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 15-02-2002 at 04:26.