Go to Post Course there's more than corn in Indiana... there's soybeans and wheat and hay and cattle and hogs and... oh never mind. :D - Jeremiah H [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-01-2009, 21:09
smcmahon's Avatar
smcmahon smcmahon is offline
The Architect
AKA: Sean McMahon
FRC #2656 (QUASICS)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Pittsburgh, PA
Posts: 197
smcmahon is an unknown quantity at this point
Post using a switch/button to turn on a motor

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?
Attached Thumbnails
Click image for larger version

Name:	labview_code.jpg
Views:	155
Size:	77.6 KB
ID:	7216  
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2009, 23:17
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: using a switch/button to turn on a motor

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.)
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2009, 19:35
whitetiger0990's Avatar
whitetiger0990 whitetiger0990 is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Earth
Posts: 157
whitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of light
Re: using a switch/button to turn on a motor

You want a Case Selector.

See attached for both cases. It sets it to 0 if off, else it to the speed control.
Attached Thumbnails
Click image for larger version

Name:	truecase.png
Views:	194
Size:	7.6 KB
ID:	7222  Click image for larger version

Name:	falsecase.png
Views:	157
Size:	7.4 KB
ID:	7223  
__________________
print$q=chr(ord($q)+$1)while("7443-0201-8465130105-12-03135-82482113-06-7672-070208-0613-70"=~/(-?\d\d)/g);
Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2009, 18:42
smcmahon's Avatar
smcmahon smcmahon is offline
The Architect
AKA: Sean McMahon
FRC #2656 (QUASICS)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Pittsburgh, PA
Posts: 197
smcmahon is an unknown quantity at this point
Re: using a switch/button to turn on a motor

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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Survey: What rate of turn gyros are you using? windell747 Electrical 5 15-02-2008 12:47
Make my motor turn! [RSMT]sturm Programming 6 24-01-2008 07:54
Push Button and Switch Suppliers for OI controls Goldberg204 Control System 8 11-01-2007 15:27
Using a button on a joystick to track? DemonYawgmoth Programming 5 12-02-2006 11:17
push-button switch on robot Conan Electrical 4 10-02-2006 22:03


All times are GMT -5. The time now is 21:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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