Thread: Spike Relay?
View Single Post
  #9   Spotlight this post!  
Unread 01-02-2012, 21:52
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Re: Spike Relay?

I don't know how much you know or don't know, so I'll cover what I can.

First be sure you created the compressor object. The parameters should be the Pressure switch channel and the relay channel that you are using on your breakouts on the cRIO. Then turning the compressor on or off is as simple as calling the start and and stop methods. From what I recall, the compressor will need to have the start() method called to turn it on in the first place ( I've done this in the initialization code for autonomous and teleOp). You can also turn it on and off using buttons or timers as well. It will automatically turn off once the pressure switch detects the system is at pressure.

Code wise:
Code:
Compressor compressor = new Compressor(1,1);  // Creates the object.  Make sure the parameters of (1,1) relate to the pressure switch and relay channels.  

compressor.start();  // Start the compressor

compressor.stop();  // Stop the compressor
Again, you will usually want to put the compressor.start() in the initialization code for the robot so it starts automatically without user intervention (unless, of course, you want to manually start it).
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
Reply With Quote