Hey guys, I’m fairly new to programming. What I want as represented with my code is to trigger the joystick on the x-axis, and somehow connect it to the “set output” box so I can manually change the direction of the shooter in correlation with the limit switches. So when the shooter hits limit switch left or right, it turns off, which is set to “0” on the inside true case. So how do I do that? I’ve tried an “or” function but my motors don’t just seems to work. Any ideas? thanks.
-ps its a Lazy Susan with Window Motors…
A thread last year included an elegant bit of LabVIEW code for handling limit switches.
You’ve got the right idea.
I’m not familiar with your hardware setup, but something like the following could probably get the job done.
The Set Output VIs (boxed in red) need to be supplied with a speed. Right click on the input node and click create constant (or something to that effect - its been a while since I’ve used labview). This will make an input variable which you can hard code to a value from 1.0 to -1.0. Start with a low value 0.2 to -0.2 and see how fast that makes the motors rotate. Also, before you fully implement this, be sure to verify you’re turning in the correct direction (toward the limit switch that should stop drive motion). If you go in the wrong direction you’ll keep going and stall the drive which could cause damage depending on your setup.
Inside the nested false block make sure you have a Set Output VI which stops the motor. Same for the case where the joystick inputs are within .1 to -.1, motor should be stopped by sending the Set Output VI “0.0”
Note: I don’t know if the “Shooter Limit Right” and" Shooter Limit Left" variables are in the correct box (may need to be switched depending on how your joystick makes the motors turn).
Goodluck, you’re on the right path.
Right, but hard wiring the “shooter rotation” from a number from 1.0 to -1.0 just doesn’t seem right. its not something like an elevator motor,(which would just be to turn on and off). It just goes LEFT and RIGHT, so if i set it to “1” it would just turn and hit the limit switch. I actually want to control the direction of the shooter via joystick values. Imagine Logomotion, and I was controlling an arm(up and down) with a joystick, its like that only left and right. Any inputs? thanks though, cleared up the limit switches!
This is probably more along the lines of what you were looking for.
Obviously this isn’t tested, but I think it will work.
Code in words: Command the motor to the value found on Axis 1 (direction & magnitude) if either of the following conditions are met:
- Commanded to the right and the right switch isn’t pressed
- Commanded to the left and the left switch isn’t pressed
Again, I don’t know which switches correlate to which directions on your stick, so the code may not work perfectly, TEST TEST TEST