LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel working and the Wait block

I am having trouble getting the NXT brick to work parallel.
If I have a case structure with in it a wait block, shouldnt the program be able to perform other tasks outside the case structure?

0 Kudos
Message 1 of 5
(6,800 Views)

Hi Bramgozer,

if you place a wait to your code and this function is executing then the rest of the code wait´s til the time is over, except you have a parallel process. What do you want to do? Why do you use a wait but don´t want to wait?

Mike

0 Kudos
Message 2 of 5
(6,799 Views)
It is for a construction that sorts M&M's on color..
The idea is that one motor drives the transport belt, and one drives a disk divided into 6 equal parts for red, green, yellow, blue, orange and brown M&M's.
when the color sensor detects a color it stops the belt, the disk turns to the corresponding compartment, and when the disk arrives, the belt starts moving again.
Here is the problem, because the M&M needs about 1.5 seconds to arrive into the compartment, and thus the disk is in a wait function. But the belt keeps moving, so new M&M's that come under the color sensor dont get detected...

0 Kudos
Message 3 of 5
(6,794 Views)

Hi Bramgozer,

you can use a case structure around the code which shall wait. Count the iterations and runt this function only for example every 15 times, if your loop needs 100ms per round.

Mike

0 Kudos
Message 4 of 5
(6,792 Views)
Do this: reset a timer when you want to start waiting. Then, inside a while loop, check to see if enough time has passed (1.5 sec) and wire the result to stop the loop. If enough time has not passed, the loop will start over again and keep checking. Using this, the rest of the program will still run. Then, you are not really stopping the program for X seconds, you are really just constantly checking to see if that amount of time has passed.
0 Kudos
Message 5 of 5
(6,759 Views)