|
|
|
![]() |
|
|||||||
|
||||||||
here are a couple snips of our program we are having trouble with the solenoids and programing, also if you find any other errors point them out thanks!
11-03-2014 15:35
Jay1986Well to fix your solenoid problem, the "solenoid set vi" needs a on/off command for single solenoids and not a true/false. To fix this, right click on the terminal of the "set vi" and hit create constant. This will give you the correct command. Then copy and paste another one and change it to "off". Then wire both commands to a select with the "on" wired to "true" and "off wired to "false". Then wire the output of your button to the input of the select and finally wire the output of the select to the input of the solenoid "set vi". Do this for both solenoids.
11-03-2014 15:38
randantor|
Well to fix your solenoid problem, the "solenoid set vi" needs a on/off command for single solenoids and not a true/false. To fix this, right click on the terminal of the "set vi" and hit create constant. This will give you the correct command. Then copy and paste another one and change it to "off". Then wire both commands to a select with the "on" wired to "true" and "off wired to "false". Then wire the output of your button to the input of the select and finally wire the output of the select to the input of the solenoid "set vi". Do this for both solenoids.
|
11-03-2014 15:47
Jay1986Other suggestions with the rest of the code: First of all, don't have all of you code in teleop. The more code you have in teleop, the laggier your controls will be since all of the code is waiting for each other before it starts another iteration. What I recommend you to do is, write all the outputs from the buttons to global variables and then put all of your code in periodic tasks with separate loops and read the global variable from teleop. Doing this also allows you to have your code run in autonomous, so you can just write to your global variables instead of rewriting all of your code in autonomous. You don't have much code, so this is not a necessity this year. Another suggestion, you are using case structures like selects, so the case structure is a bit unnecessary. Also, the "motor set vi" reads values from -1 to 1, not -255 to 255. Other than that, it looks fine.
Hope this helps!
11-03-2014 15:48
WoollyCorrect me if I'm wrong, but for a double solenoid, don't you need to select between forward and reverse to make the mechanism extend and close.
Also, looking at your comments you want it to toggle being in or out on button press.
You will need to wire your button through this vi (thank you Channel Cats)
http://2013swat-robot-code.googlecod...E-FLIP-FLOP.vi
and then to a select statement that selects between the forward and reverse constants.
11-03-2014 16:19
Mark McLeod
Except those are Single solenoids, not doubles.
But the button toggle suggestion is good.
11-03-2014 17:06
AGPapaThe motor sets need a double from -1 to 1, not an integer.