|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Problem with the compressor class
Hey, I am from team 4590.
We are having trouble with the compressor- it does nothing. The pressure switch is connected to DigitalInput 1 and the Spike to Relay 2. This is our full simple code: note: when we use the Relay.Set() function (and don't use the Compressor class at all) the compressor works. Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
Joystick stick;
Compressor comp;
public:
RobotDemo(void):
stick(1),
comp(1,2)
{
comp.Start();
}
void Autonomous(void)
{
Wait(2.0);
}
void OperatorControl(void)
{
while (IsOperatorControl())
{
Wait(0.005);
}
}
void Test() {
}
};
START_ROBOT_CLASS(RobotDemo);
|
|
#2
|
||||||
|
||||||
|
Re: Problem with the compressor class
How is the pressure switch wired?
|
|
#3
|
||||
|
||||
|
Re: Problem with the compressor class
I believe the problem is that you won't have any effect on things if you do your comp.Start() from the constructor - RobotDemo(). It is much more normal to see the starting of the compressor at the beginning of OperatorControl() outside of the while loop. And if you need the compressor in Autonomous, you would also call comp.Start() in the beginning of Autonomous().
bob |
|
#4
|
||||
|
||||
|
Re: Problem with the compressor class
Quote:
|
|
#5
|
|||
|
|||
|
Re: Problem with the compressor class
Thank you for answering.
I have started the compressor in the OperatorControl() and it worked, but then I tried again to start it in the ctor and it also worked. I have tried to look for the problem and I saw that it only works when I instantiate a RobotDrive. Can it be or is it just a coincidence? |
|
#6
|
||||||
|
||||||
|
Re: Problem with the compressor class
If you digitital side car is not properly wired, I could see trying to run multiple PWMs cause a problem with reading the pressure switch.
|
|
#7
|
|||
|
|||
|
Re: Problem with the compressor class
It turn out one of the wires of the pressure switch was not connected properly.
Once we fixed it the Compressor started and stopped as expected. Thank you for your help. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|