View Single Post
  #3   Spotlight this post!  
Unread 02-12-2004, 17:23
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Help With Compressor Code

if you dont want to just use the default code and would rather write it yourself to fully learn how it works, you can do something like this..

Put a line in the default routine that will call a function that will check the compressors pressure (whether the pressure switch is on or off).

If the switch's input goes high, turn on the compressor. Then when there is enough pressure the switch will change states and you can turn the compressor off.

In our program, we made "Compressor" an alias for a relay output (Relay 3 in our case), and "CompSwitch" an alias for the digital input the pressure switch was on. You can code these lines in the "user_routines.h" file with the syntax
Code:
#alias NewName    OldName
Our Compressor checking function looked like this.
Code:
void CheckComp(void)
{
	if(CompSwitch == 1)
	{
		Compressor  = 1;
	}
	else
	{
		Compressor = 0;
	}
}