View Single Post
  #13   Spotlight this post!  
Unread 02-02-2011, 22:51
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Compressor programming please help

To control the compressor, you just use the Compressor class. You instantiate a single Compressor object, telling it which relay port is connected to the compressor and which Digital I/O port is connected to the pressure switch. You then call its Start() method.

That's it. Nothing more. You do not create a Relay object for it. You do not create a DigitalInput for it.

Take out everything in your code that you have put in to try to make the compressor work, and replace it with two lines in your initialization code:

Code:
Compressor *myCompressor = new Compressor(1, 5); 
myCompressor->Start();
"1" is the Digital Input with the pressure switch. "5" is the Relay powering the compressor.

You could also make myCompressor a regular variable instead of a pointer and call the object's constructor as part of the RobotDemo constructor, but I'm not as comfortable as some people are with the requirements for what order things have to be specified.
Reply With Quote