Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Limit Switch Programming Help (http://www.chiefdelphi.com/forums/showthread.php?t=125693)

eren96 02-02-2014 15:32

Limit Switch Programming Help
 
Hi Guys,

We are building a catapult mechanism to shoot the ball and to set the position of the catapult to ready to shoot, we are using a limit switch. I want the program to run 2 motors until the limit switch is on while i'm pressing a button on joystick, so the catapult will stop itself when it's stretched enough.

I wrote this in teleop, but it didn't work. Where am i wrong? I wrote their begin and finish parts as well.


Cecil 02-02-2014 15:39

Re: Limit Switch Programming Help
 
Are you by any chance using Jaguars? You could always wire your limit switch directly to the inputs on the Jaguar itself and let it do all the work.

On the other hand, how is your limit switch wired? Remember that the Digital Sidecar inputs are always pulled high until you pull them low. Wire your limit switch with the signal wire going to COM and the negative wire to the NO terminal.

With this wiring, you will also need to switch your comparison values (switch the 0 and 1) so that when the switch is pressed (goes false) it will stop your motors

Alan Anderson 02-02-2014 18:23

Re: Limit Switch Programming Help
 
Quote:

Originally Posted by eren96 (Post 1336399)
I wrote this in teleop, but it didn't work. Where am i wrong?

You say it didn't work. What did it do instead of what you wanted?

Are you sure your limit switch is giving you True and False values in the direction you expect? Use the Test mode and view the switch's value on the Dashboard to see what it really does.

eren96 05-02-2014 16:58

Re: Limit Switch Programming Help
 
Quote:

Originally Posted by Cecil (Post 1336404)
Are you by any chance using Jaguars? You could always wire your limit switch directly to the inputs on the Jaguar itself and let it do all the work.

On the other hand, how is your limit switch wired? Remember that the Digital Sidecar inputs are always pulled high until you pull them low. Wire your limit switch with the signal wire going to COM and the negative wire to the NO terminal.

With this wiring, you will also need to switch your comparison values (switch the 0 and 1) so that when the switch is pressed (goes false) it will stop your motors

I don't use Jaguars as motor controllers. I wired the white wire to the NC and black wire to the COM and wired the other side of the PWM cable directly to the one of the DIO s on the Digital Side Car, but i have still problems with that.

eren96 05-02-2014 17:01

Re: Limit Switch Programming Help
 
Quote:

Originally Posted by Alan Anderson (Post 1336514)
You say it didn't work. What did it do instead of what you wanted?

Are you sure your limit switch is giving you True and False values in the direction you expect? Use the Test mode and view the switch's value on the Dashboard to see what it really does.

When I press the button, motors move for a moment and then stops. The movement isn't continous as I press the button. How can I use the test mode to test this? Do I need to edit the Test VI ?

Mark McLeod 05-02-2014 18:05

Re: Limit Switch Programming Help
 
Where have you put this code (Teleop, Periodic Tasks)?

What does your Begin look like for creating the motor?

Alan Anderson 05-02-2014 21:26

Re: Limit Switch Programming Help
 
The code you posted looks okay. Is there somewhere else in the program that might be continually turning off your winch motors, like in Periodic Tasks? Is the case input connected directly to a joystick button, or is there some other processing before it reaches the case?

Is your motor wiring correct, with both motors turning in a direction that doesn't make them fight each other? Install only one winch motor circuit breaker and try running it, then remove that breaker and install one on the other winch motor. Do the motors run as expected one at a time?

eren96 06-02-2014 10:07

Re: Limit Switch Programming Help
 
Quote:

Originally Posted by Alan Anderson (Post 1338267)
Is there somewhere else in the program that might be continually turning off your winch motors, like in Periodic Tasks?

This sentence solved my problem.

Not in Periodic Tasks, but in Teleop I was controlling those motors with one more button as well. I solved this by combining two case. So now, when i m not pressing that button, the motors aren't set themselves to 0 value.

Thanks for your help.


All times are GMT -5. The time now is 09:55.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi