{"id":10645,"date":"2015-08-06T17:44:10","date_gmt":"2015-08-06T07:44:10","guid":{"rendered":"http:\/\/legoeng.local\/?p=10645"},"modified":"2017-12-21T14:39:27","modified_gmt":"2017-12-21T03:39:27","slug":"how-to-reconnect-a-task-split","status":"publish","type":"post","link":"http:\/\/legoeng.local\/how-to-reconnect-a-task-split\/","title":{"rendered":"How to reconnect a task split"},"content":{"rendered":"
This article describes a method for “reconnecting” the separate paths of an EV3 program after a task split. It’s usually best to avoid task splits where possible, especially because of the risk of them leading to a “race condition” (more of this later in a separate post) but sometimes they’re hard to avoid.<\/p>\n
Let’s say we want to run two motors independently and then stop each one in response to a particular EV3 button. In this example, Motor A will run until the Left EV3 button is pressed and, at the same time, Motor D will run until the Right EV3 button is pressed. The task split provides a simple way of setting this up so that the motors can be turned off in either order.<\/p>\n
<\/a><\/p>\n What if we want to continue the program after both motors have been turned off, but still allow for them to be turned off in either order? For example, how could we modify the previous example so that the cheering sound is played only after both task have completed?<\/p>\n