Hi,
We want a button to start the relay in reverse, and one for it to go forward. We also have a button to make it stop. The problem is that the spike is only getting the signals to send it in reverse and to stop.
our code for it is as follows:
Code:
// We need to decide what buttons belong to which functions.
AvoidTipOver(joyBtnShooter7Pushed,
joyBtnShooter8Pushed,
joyBtnShooter9Pushed,
joyBtnShooter5Pushed);
//these are all configured properly, at one point, we were using this for our pneumatics
void AvoidTipOver(bool btn7,
bool btn8,
bool btn9,
bool btn5)
{
// tells the tipBarLeft/Right to be able to work both directions, but it does not seem to
// be working at the moment, tweak this to make it work better.
tipBarLeft->SetDirection(Relay::kBothDirections);
tipBarRight->SetDirection(Relay::kBothDirections);
if (btn8)
{
tipBarLeft->Set(Relay::kForward);//when btn8 is pressed we want it to be set in the forward position.
}
if (btn9)
{
tipBarLeft->Set(Relay::kReverse);//when btn9 is pressed we want it to be set in the reverse position.
}
if (btn5)
{
tipBarLeft->Set(Relay::kOff);//when btn 5 is pressed we want it to stop.
}
}
tipBarLeft = new Relay(TipBarLeft);
tipBarRight = new Relay(TipBarRight);//not used at the moment, we are just testing on a mock-up board.
tipBarLeft->Set(Relay::kOff);
tipBarRight->Set(Relay::kOff);
The relay is on channel 1 and is getting power. When we press button 9, it goes in reverse. When we press button 5, it stops. When we press button 8, it stays in the off position.
thanks,
Mr. Stone