Log in

View Full Version : Has anyone figured out limit switches for 2015


Intern
17-01-2015, 15:32
i do not know how to code limit switches in 2015 labview, can someone comment a picture and show me how to do it, i have it done in begin all i need is teleop

Alan Anderson
17-01-2015, 16:02
What do you want the limit switch to do? Describe exactly what you want the robot to do when the switch is open and when it is closed, and we can help you program it to do that.

Intern
17-01-2015, 16:13
when the limit switch is pressed i want the cim motor to stop going that direction so it doesn't de-rail

Alan Anderson
17-01-2015, 16:35
That's a pretty typical use of a limit switch. Here's how I would do it, using an In Range and Coerce function. When the switch value is not true, the motor control is allowed to vary between -1 and +1. When the switch is true, the motor is only allowed to be between -1 and 0, keeping it from traveling any farther forward.

andboyer
18-01-2015, 13:40
What motor controllers are you using? With the new controller you can connect the limit switch directly to the controller and it will function without any additional code. https://www.google.com/url?sa=t&source=web&rct=j&ei=VP67VNqFF4K0yATj64LQCw&url=http://www.crosstheroadelectronics.com/Talon%2520SRX%2520Software%2520Reference%2520Manua l.pdf&ved=0CCsQFjAG&usg=AFQjCNFSsBJfgLdd_uKZsY1Szi0wWXm3pg&sig2=ipxqsA3rdAP2YN2BXa9lJQ

1uan
20-01-2015, 17:37
How do you get the motor control dbl to show up

Alan Anderson
21-01-2015, 00:59
How do you get the motor control dbl to show up

In my snippet, that was just a placeholder to represent the value you want to send to the motor. How you come up with that value is up to you. You can get it from a joystick axis, or select between different values based on joystick buttons, or compute it using PID based on sensor feedback, or anything you want.

1uan
21-01-2015, 09:54
thank you for the explanation

TheJuanRing
04-02-2015, 18:15
hey this is kind of a followup, but has anyone figured out how to do it with c++???

ozrien
04-02-2015, 19:18
This might help....the examples are in Java, but the class names are pretty similar.

http://wpilib.screenstepslive.com/s/4485/searches?utf8=%E2%9C%93&text=limit+switch&commit=Search

mshafer1
05-02-2015, 16:16
This might help....the examples are in Java, but the class names are pretty similar.

http://wpilib.screenstepslive.com/s/4485/searches?utf8=%E2%9C%93&text=limit+switch&commit=Search

Here are some more examples in LabVIEW, both the limit switch tutorial and the state machine tutorial use a limit switch scenario.
Website of LabVIEW Tutorials for FRC (http://goo.gl/15uiB7)

TheJuanRing
05-02-2015, 17:20
Here are some more examples in LabVIEW, both the limit switch tutorial and the state machine tutorial use a limit switch scenario.
Website of LabVIEW Tutorials for FRC (http://goo.gl/15uiB7)

This might help....the examples are in Java, but the class names are pretty similar.

http://wpilib.screenstepslive.com/s/4485/searches?utf8=%E2%9C%93&text=limit+switch&commit=Search



thanks, both of you guys, for the examples, it is a huge amount better than what i had before
(•‿•)
Edit: In hind sight I really should have thought about searching for that on the WPILib website