Log in

View Full Version : using a switch/button to turn on a motor


smcmahon
24-01-2009, 21:09
As a novice LabView programmer, I'm going to post this here to see if it's a viable way to code the outcome I'm looking for... which it this:

I have a CIM motor. It's connected to a Jaguar, and then to PWM channel 10 on the digital sidecar in Slot 4. I want to set a speed for this motor in the code (preferably in percentages, like 85%). And then I want to have a switch turn that motor on/off. In the final outcome, I imagine I'll actually have a joystick turn this on/off, but for now, I want to test it with a button on the Front Panel.

I've attached the code I wrote. It's in a while loop, which I am hoping is controlled properly by the ON/OFF switch (Boolean). Does this look like it will work to do what I want?

Alan Anderson
24-01-2009, 23:17
Unless what you want it to do is cause the code to sit doing nothing but set the fan speed while the "fan on" switch is true, and eventually have the watchdog activate and disable everything, I don't think that code will do what you want.

The easiest way to have a button turn a motor on and off is probably to use a "boolean selector" to choose which of two speed values to send to the motor based on the state of the button. (I don't have a copy of LabVIEW available right now, so I can't provide a picture of a simple example.)

whitetiger0990
25-01-2009, 19:35
You want a Case Selector.

See attached for both cases. It sets it to 0 if off, else it to the speed control.

smcmahon
26-01-2009, 18:42
Thank you very much whitetiger0990. I'm going to give that a shot. That seems SO simple now. Being so new to LabView though, I hadn't thought of it like that.