FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Button in Labview?

Solved!
Go to solution

Hi, i am new to labview, but im getting the hang of it, i successfully configured a tank drive last night, and now im having trouble with buttons, is there any sample code that show how to configure a button to drive a motor? All i want to do is when button is pressed motor runs at 100% its a spike motor and then when button is released motor stops.

0 Kudos
Message 1 of 5
(5,555 Views)
Solution
Accepted by topic author Programmer1696

Hi,

It uses the "Unbundle by Name" in the "Cluster, ..." pallet after right clicking on the block diagram.

I have provided pictures and attached the VI coding that shows ways to do it. Although I have never messed with Spike coding (I think I get it) but what I have been doing is still programming it to a PWM and a Victor/Jaguar which works great (using that on my team's robot this year).

Tutorial 1.1.pngTutorial 1.2.png

Post if you have any questions on the code.

Glad to Help,

Davis Catherman

0 Kudos
Message 2 of 5
(3,203 Views)

Thanks so much, it should be east to convert it to a relay, would you happen to know anything about "watchdog not fed" wont let me run my program

0 Kudos
Message 3 of 5
(3,203 Views)

Hi,

I actually do. Although it is a system that must be perfect or issues are caused.

There are two different ways to code:

1. The Unproper Way

     -all of the code is in a seperate file that uses a while loop

     -file must be called in Robot Main.vi

     -I've never succeeded with the camera in this format

2. The Proper Way

     -all the code is called in the Begin.vi then executed in Autonomous.vi and Teleop.vi, then all is closed in the End.vi

     -It is a REALLY good idea to learn this way (i started it this year and many things work better)

     -great place to learn it is FRCmastery.com

Pictures provided and attached. (I am using examples from two different codes I made this season, and for the most part, they work)

(and yes, in my coding I call it  "Ye O' Faithful Watchdog" )

To do the UN-proper Way:

Watchdog Pic Unproper.png

To do it PROPERLY:

Watchdog Pic Proper.png

Anything else need help with?

Glad to Help,

Davis Catherman

0 Kudos
Message 4 of 5
(3,203 Views)

On the subject of watchdogs:

If I'm correctly reading the FRC 2011 Safety Config document, it is no longer necessary to use the Watchdog at all.  So the easiest thing to do might be to eliminate all calls to the Watchdog VIs since they're no longer required (although you are still welcome to use them).

If you're still getting Watchdog errors after that, make sure you read through that Safety Config document to understand how often you need to update your motors, solenoid valves, etc.  The error message should tell you which system is generating the watchdog timeout.

0 Kudos
Message 5 of 5
(3,203 Views)