![]() |
Limit Switch Draws Tears
Imagine yourself: 11 hours, 5 programmers, no mentors, 1 fiesty limit switch. The result? 5 programmers suffering a severe mental breakdown.
We are attempting to program a very simple limit switch that will disable a motor when the limit switch circuit is closed. We have wired the two limit switch wires into to the ground and signal connections on input four of the digital sidecar. We are programming in C++ and whenever we attempt to get a signal back from the input it always shows up as equaling one, no matter what we do. Please help us, it seemed so simple when we started 11 HOURS AGO! |
Re: Limit Switch Draws Tears
what are you using to discover the value? The Dashboard? If so the default dashboard code returns hard-coded values that do not reflect the status of the system
Make sure the digital module is on slot 4. Also make sure power is properly wired to the sidecar. Try last year's sidecar if you have to. Also try a different limit switch. If you are using the CAN bus for motor control, you could just directly wire the limit switch to the Jaguar and forget about this entire mess |
Re: Limit Switch Draws Tears
Quote:
What are you using as a limit switch? The microswitches I'm familiar with have three connections. |
Re: Limit Switch Draws Tears
As far as we can tell everything is as you say, we have the module in slot 4 and are attemting to get the state of the input directly from the module itself not the dashboard. We simply created an object called Dig4 and set it equal to DigitalInput(1), here's the code.
Code:
#include "WPILib.h"Soo, we are still stuck. |
Re: Limit Switch Draws Tears
Which rule was that? <R54> is the no modifying motors rule.
<R60-L> reads: Quote:
Quote:
|
Re: Limit Switch Draws Tears
This is going to sound very strange, but today (we haven't ever come in on sunday before) my team was supposed to spend 4 hours in the shop to clean up the wires on our bot for a revealing day/ showcase tommorow. After putting everything back together, our robot still didn't run. 5 hours later we realized that a limit switch was creating a short. It took us about a total of 13 hours to get it going. I feel your immense pain.
|
Re: Limit Switch Draws Tears
<<< Dig1 = new DigitalInput(1, 1); >>>
Your digital sidecar is in slot 4, so the line above should be Dig1 = new DigitalInput(4,1); if my memory serves me correctly, assuming that you are using digital input 1 as the code implies. |
Re: Limit Switch Draws Tears
In your constructor, I see this line that stands out:
Code:
Dig1 = new DigitalInput(1, 1);Code:
DigitalInput::DigitalInput(UINT32 slot, UINT32 channel)If you change it to look like this it should read Digital Input #1 from the default digital module (module #4). Code:
Dig1 = new DigitalInput(1); |
Re: Limit Switch Draws Tears
Quote:
Therefore, I would guess that the statement above should be Dig1 = new DigitalInput(4, 4); Or am I missing something? Regards, Mike |
Re: Limit Switch Draws Tears
Quote:
|
Re: Limit Switch Draws Tears
We have tried all of the possible solutions however they have all failed terrifically.
|
Re: Limit Switch Draws Tears
Quote:
Now, don't get me wrong. Your code has more than one problem (like 3 conditions for a Boolean condition) but, for anyone to help, you need to clearly define what is wired and what you want to do, in plain language please... Mike |
Re: Limit Switch Draws Tears
where exactly would these 3 conditions for a boolean variable be?
|
Re: Limit Switch Draws Tears
The digital input is one, or zero.
Don't count on the code handled by the final else statement to ever get executed. if (Dig1->Get() == 0) { jag1->Set(0.0); jag2->Set(0.0); jag3->Set(0.0); jag4->Set(0.0); } else if(Dig1->Get() == 1) { jag1->Set(-leftstick->GetY()); jag2->Set(rightstick->GetY()); jag3->Set(-leftstick->GetY()); jag4->Set(rightstick->GetY()); } else { jag1->Set(-1.0); jag2->Set(1.0); } |
Re: Limit Switch Draws Tears
Ahhh... While I sleep, my minions carry on!
Thanks Doc. A switch is either ON or OFF... |
| All times are GMT -5. The time now is 02:19. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi