ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

取消
显示结果 
搜索替代 
您的意思是: 

Really simple question, stop function and scroll bar won't work

已解决!
转到解答

I was working on different parts of this VI separately, when I put them together the scroll bar and stop button stopped working. 

 

In the individual VI both are in the while loop. In the final one I was one scroll bar and one stop button to apply to all 5 while loops.

 

I tried taking the scroll bar in and out of the first loop to attach it to the rest but it still won't work.

 

I'm sure that there is a really stupid simple answer but I've been playing with it for a while.

 

I attached the VI that I am working on as well at fake data (to test the color boxes).

 

Thanks!

 

 

下载全部
0 项奖励
1 条消息(共 4 条)
2,561 次查看
解答
已被主题作者 sofiakyle 接受

You have a typical beginner problem due to incorrect understanding of dataflow. Run the code using execution highlighting and watch the diagram to see.

 

  1. Your stop button is outside any loop and thus will only be read by the code exactly once at the start of the program.
  2. Your scroll bar is read in the first loop. All other loops cannot start until the first loop has completed and since (1) is true, it will never happen if the boolean is false when the code starts.

Why do you have so much duplicate code? 95% of the loop code is the same and can be re-used. I am sure the entire thing could be written using 5% of the total code. Put everything in one loop, the iterate over the 2D array to get all the values. Don't forget to place a small wait inside the while loop.

2 条消息(共 4 条)
2,552 次查看

I don't understand how I could do this. The code that in the while loop accepts only single numbers, when i change it to an array the booleans don't match up. Also the sink in the RGB to Color stops working with arrays. Would I have to change how to code works? Or can I alter the begining? If I'm using an array wouldn't it have to carry all the way through so that I could index it and apply each one to a different sensor?

 

Sorry I'm new 沮丧表情

 

Thanks!

0 项奖励
3 条消息(共 4 条)
2,539 次查看

Actually nevermind! I got it,

 

Thanks! 🙂 

0 项奖励
4 条消息(共 4 条)
2,529 次查看