07-09-2018 11:01 AM
Hello guys and I appreciate your comments on my previous post.
I have a pretty simple question.
I have some user prompts for a stepper motor control with arduino. In this case the user will either tick type 1 or type 2 checkbox and then he will enter the speed that he wants the stepper motor to go. As I am still an amateur that's the only way that I think the speed from the user prompts can be moved inside the loop.
In each case only one number will exist so the number has to go to the stepper write function.
Can you advice of a better way to do the same thing? I believe there must be a better, more efficient one.
Thanks in advance
07-09-2018 11:14 AM
@tsakitsan wrote:
Hello guys and I appreciate your comments on my previous post.
I have a pretty simple question.
I have some user prompts for a stepper motor control with arduino. In this case the user will either tick type 1 or type 2 checkbox and then he will enter the speed that he wants the stepper motor to go. As I am still an amateur that's the only way that I think the speed from the user prompts can be moved inside the loop.
In each case only one number will exist so the number has to go to the stepper write function.
Can you advice of a better way to do the same thing? I believe there must be a better, more efficient one.
Thanks in advance
This kind of question from someone who is trying to SELL their developed software? I think it's time to show some code so we can at least help you to avoid bankruptcy trying to settle a lawsuit.
07-09-2018 11:57 AM
To pick between two values, only one checkbox is needed. (Two check boxes give you four possibilities: FF, FT, TF, TT). Alternatively, you could use a radiobutton control.
We cannot show you a "better" way unless you show us your code. Verbal descriptions are too ambiguous.
07-10-2018 02:14 AM
Thanks for helping me guys. I will get better at it.
07-10-2018 07:19 AM
@tsakitsan wrote:
Thanks for helping me guys. I will get better at it.
THAT's the spirit! Don't forget to visit the training links on the main forum page. But don't forget that this forum is an important part of learning, either! 🙂
07-10-2018 10:09 AM - edited 07-10-2018 10:11 AM
There are a few things in your code that don't make sense or won't work properly. First, there's nothing preventing the user from checking zero or two boxes in the first dialog. A Two Button Dialog would be better suited for this. Second, why have two separate dialog boxes asking for Speed, when one will do regardless of the system being "Type 1" or "Type 2"? If you need different prompts, instead of executing both dialog box Express VIs (albeit with one disabled, hopefully, if the user only checked one box), how about putting the dialog box VIs in a case structure instead, so only one of them executes and you only have one "Speed" output to handle? Third, if a dialog box is disabled, the Speed output won't be NaN, it'll be the default value of zero, so your "Not A Number/Path/Refnum" tests will always be false (unless the user enters "NaN", that is). If they did output NaN then your case structures would have the effect of changing them back to zero anyway. Fourth, adding the two Speed values together while assuming that one will always be zero is not straightforward; if you want to select between two values using a boolean, try the "Select" function instead.