Thread: Compressor
View Single Post
  #8   Spotlight this post!  
Unread 16-01-2013, 10:42
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Compressor

Your sample code states the compressor is digital i/o 4, and relay 2, you say you are using relay 3; is that your issue?

Try calling compressor->Start() in your teleop/autonomous loop.

The code you presented is fine otherwise, though I would opt to directly instance compressor, rather than allocating it dynamically, but it's a point of preference. I also prefer to derive from IterativeRobot instead of SimpleRobot

Code:
class Robot2012 : public IterativeRobot
{
Compressor compressor;
public:

Robot2012(void):compressor(DIGITAL_CHANNEL_1_INPUT_COMPRESSOR_SWITCH, RELAY_CHANNEL_1_COMPRESSOR_RELAY)
{
}

void DisabledInit(void)
{
    compressor.Stop();
}
void AutonomousInit(void)
{
     compressor.Start();
}
void TeleopInit(void)
{
     compressor.Start();
}

Here's a link to my 2012 code: https://github.com/TeamExcel/Project.../Robot2012.cpp
Reply With Quote