02-25-2013 06:15 PM
We have two limit switches we want to prevent the motor from going too far in reverse as well as forward. We have some code that uses the limit switches to stop the motor from moving, but have not been able to get it to work. Also, we are having trouble getting indicators for the DIO's on both the driver station and the dashboard. Code attached. Thanks for your help!
02-26-2013 09:58 AM
In Teleop, your "In Range and Coerce" needs to include the upper limit.
Right now it only pays attention to the lower limit switch.
Right-click on the "In Range and Coerce" and choose "Include upper limit" from the pop-up menu.
You should check that the boolean values coming from the limit switches are what you expect them to be.
If you run in Debug you can probe the wires to see the values generated by pressing/not pressing each switch.
The values differ depending on whether the switch was wired Normally-Open (NO) or Normally-Closed (NC).
On your Dashboard I don't see where you added the "Digital Input 2" boolean indicator.
I'm probably just overlooking it.
02-26-2013 05:58 PM
If you haven't already please read these discussions
https://decibel.ni.com/content/thread/16150?tstart=0
and
https://decibel.ni.com/content/thread/16068?tstart=0
As these discussions explain your code will only work if you have a NC limit switch connected to Sig and [-] on the digital side car
If you want to see the limit switches on you Dashboard you will need to add an indicatior to the Front Panel and wire it to a
SD Read Boolean vi in the Dashboard pallet.
After you have coded in all your indicators you will need to build the new dashboard into an executable.
Follow the tutorial on building a new dashboard.
Make sure the exe is named dashboard.exe
Then rename the old dashboard and place the new one in the same folder.
My dashboard folder is C:\Program Files (x86)\FRC Dashboard
When the driver station starts it goes to this folder and runs dashboard.exe
Good Luck
Mark