{"id":12482,"date":"2017-10-19T16:34:15","date_gmt":"2017-10-19T05:34:15","guid":{"rendered":"http:\/\/legoeng.local\/?p=12482"},"modified":"2019-04-02T15:17:47","modified_gmt":"2019-04-02T04:17:47","slug":"how-to-wait-for-more-than-one-sensor-condition","status":"publish","type":"post","link":"http:\/\/legoeng.local\/how-to-wait-for-more-than-one-sensor-condition\/","title":{"rendered":"How to Wait for More than One Sensor Condition"},"content":{"rendered":"
The Wait block is one of the simplest blocks in the EV3 Software, and provides one of the simplest flow control structures. Its basic function is to pause the execution of a program until a particular condition is met, and then\u00a0continue with the program. For example,\u00a0“wait until the touch sensor is pressed”<\/em> or “wait for three seconds”<\/em>.<\/p>\n But what if you want a program to wait until either of two (or more) possible conditions occur? For example, “wait until EITHER the color sensor detects black\u00a0OR\u00a0the touch sensor is pressed”<\/em>.<\/p>\n This learning sequence explains how the Wait block is built in the EV3 Software, its advantages and limitations, and how to expand its programming functions to accommodate multiple conditions.<\/p>\n Through this learning sequence, students will\u00a0gain a deeper understanding of:<\/p>\n In the following example, the program waits until a touch sensor is pressed to start a motor for one rotation.<\/p>\n\n
Exercise 1: Wait until a touch sensor is pressed<\/h2>\n