Wait Block Icon of block

等待指令


Wait Block

等待指令可以讓機器人依據某個條件先感測週遭環境而後再繼續動作.以滑桿或輸入觸發值並與感應器數值相較來作為程式繼續執行與否.
This block lets your robot sense its environment for a certain condition before it continues. Use the slider or type in a value to set a trigger point so that the program continues when sensor values are below or above it.

Image of Wait block, default settings

  1. 在等待指令的右上角標示出所連結的輸入端.視需要可以參數面板來更改輸入端.
    The number or letter at the top right corner of the Wait block shows the port the block is monitoring. The configuration panel, which is described below, will let you change ports if necessary.
  2. 假設等待的是光源,聲控,超音波感應器.這個圖示會將觸發值分等來呈現.越亮麗的色彩表示越高的觸發值.如果等待的是觸控感應器.則會出現觸控感應器用來處發指令繼續執行的狀態(觸碰,按下,或是放開).
    If you have chosen to wait for a light, sound, or ultrasonic sensor, this icon indicates at what level the trigger point is set; the more colored bars displayed, the higher the trigger point. If you have chosen to wait for a touch sensor, the icon will display the touch sensor condition (bumped, pressed, or released) that will trigger the block and allow the program to move on.

設定等待指令
Configuring the Wait Block

控制參數的下拉式選單有兩種主要條件可供選擇:
The Control property pull-down menu will let you choose from two primary conditions to wait for:

觸控感應器
Touch Sensor

Image of the configuration pane for the Wait-Touch Sensor block

選擇"觸控感應器"會讓程式在執行下一個指令之前先等待觸控感應器的狀態:觸碰,按下,或是放開.
Choose “Touch Sensor” and your program will wait for a touch sensor to be bumped, pressed, or released before going on the next block in your program.

  1. 選擇觸控感應器的輸入端,預設值是1號輸入端.
    Choose the port that the touch sensor is connected to. By default, the block will be set to port 1 for a touch sensor.
  2. 選擇觸控感應器的狀態:觸碰,按下,或是釋放,以讓程式繼續.觸碰表示指令會在感應器被快速地按下與釋放後繼續執行.按下表示指令會在感應器當時被按下後繼續執行.釋放表示指令會在感應器當時被釋放後繼續執行.
    Use the radio buttons to specify whether you want the touch sensor to be bumped, pressed, or released to let the program continue. Choose Bumped if you want the block to be triggered after a quick press and release of the touch sensor. Choose Pressed if you want the block to be triggered at the instant the touch sensor is pressed in. Choose Released if you want the block to be triggered at the instant the touch sensor is released.
  3. 回饋區可供測試觸控感應器.當機器人上的感應器有作用時,會顯示數字1.
    The feedback box will let you test your touch sensor. When the sensor is activated on your robot, the number 1 will be displayed here.

聲控感應器
Sound Sensor

Image of the configuration pane for the Wait-Sound Sensor block

使用"聲控感應器"會讓程式等待某個音量達到時再執行.
Choose “Sound Sensor” and your program will wait for the sound sensor to be activated by a certain intensity of sound.

  1. 選擇聲控感應器的輸入端,預設值是2號輸入端.
    Choose the port where your sound sensor is plugged in. By default, the block will be set to port 2 for a sound sensor.
  2. 使用滑桿或輸入數值來設定觸發值.右邊的單選按鈕是表示指令會在音量比觸發值高的情況下被啟動.左邊的單選按鈕表示程式會在比觸發值低的情況下被啟動.也可以使用下拉式選單來設定"真"值的滑桿位置.
    Use the slider to set the trigger value or type a value into the input box. Select the radio button to the right of the slider if you want the block to be triggered by sound levels higher than the trigger value; select the left radio button to trigger the block with sound levels lower than the trigger value. You can also use the pull-down menu to set the “true” portion of the slider.
  3. 回饋區顯示現在所偵測到的音量(0~100%).也可以用來測試不同的觸發值.
    The feedback box displays the current sound reading (0-100%). You can use it to try out different trigger values.

光源感應器
Light Sensor

Image of the configuration pane for the Wait-Light Sensor block

使用"光源感應器"會讓程式等待某個光量達到時再執行.
Choose “Light Sensor” and your program will wait for a light sensor to be activated by a certain intensity of light.

  1. 選擇光源感應器的輸入端,預設值是3號輸入端.
    Choose the port where your light sensor is plugged in. By default, the block will be set to port 3 for a light sensor.
  2. 使用滑桿或輸入數值來設定觸發值.右邊的單選按鈕是表示指令會在光量比觸發值高的情況下被啟動.左邊的單選按鈕表示程式會在比觸發值低的情況下被啟動.也可以使用下拉式選單來設定"真"值的滑桿位置.
    Use the slider to set the trigger value or type a value into the input box. Select the radio button to the right of the slider if you want the block to be triggered by light levels higher than the trigger value; select the left radio button to trigger the block with light levels lower than the trigger value. You can also use the pull-down menu to set the “true” portion of the slider.
  3. 如果勾選"產生光源"選項,光源感應器會打開光源並偵測所反射回來的光量.
    If you check the “Generated Light” checkbox, the light sensor will turn on its own small light source and detect this light if it is reflected back to it.
  4. 回饋區顯示現在所偵測到的光量(0~100%).也可以用來測試不同的觸發值.
    The feedback box displays the current light reading (0-100%). You can use it to try out different trigger values.

超音波感應器
Ultrasonic Sensor

Image of the configuration pane for the Wait-Ultrasonic Sensor block

使用"超音波感應器"會讓程式等待偵測到某個物體在一定距離內再執行.
Choose “Ultrasonic Sensor” and your program will wait for the ultrasonic sensor to be activated by detecting an object at a certain distance.

  1. 選擇超音波感應器的輸入端,預設值是4號輸入端.
    Choose the port where your Ultrasonic sensor is plugged in. By default, the block will be set to port 4 for an ultrasonic sensor.
  2. 勾選滑桿左邊的單選按鈕,此指令會在偵測物體在觸發距離的範圍內而啟動.如果勾選右邊的單選按鈕,指令會在偵測物體遠離觸發距離而啟動.也可以使滑桿來設定觸發距離或是輸入數字(0~250是以公分為單位,若是英吋則是0~100).記住的是,表面反射度高的物體會比反射度低的物體在更遠的距離被偵測到.
    If you choose the radio button to the left of the slider, the block will be triggered when it detects an object that is closer than the trigger distance; select the right radio button to trigger the block when it detects an object farther away than the trigger distance. Use the slider to set the trigger distance or type a value directly into the input box (0-250 if configured for centimeters or 0-100 if configured for inches. Remember that highly reflective surfaces can be detected farther away than non-reflective surfaces.
  3. 選擇公分或是英吋為單位.
    Select to read values in Centimeters or Inches.
  4. 回饋區顯示現在超音波所偵測到的距離(0~100公分或是0~100英吋).0表示感應器所能偵測的最近距離.如果以公分為單位,則250表示感應器所能偵測的最遠距離(大約250公分),若是以英吋為單位,則100表示感應器所能偵測的最遠距離(大約是100英吋)The feedback box displays the current ultrasonic reading (0-250 cm or 0-100 inches). A reading of 0 indicates the closest distance the sensor can detect. If configured for centimeters, a reading of 250 indicates the farthest distance the sensor can detect (i.e., roughly 250 cm). If configured for inches, a reading of 100 indicates the farthest distance the sensor can detect (i.e., roughly 100 in).

NXT按鍵
NXT Buttons

Image of configuration pane for Wait - NXT Buttons

選擇"NXT按鍵"會讓程式在執行下一個指令之前先等待NXT按鍵狀態:觸碰,按下,或是放開.
If you choose “NXT Buttons,” the program will wait for a chosen NXT buttons to be bumped, pressed, or released before moving on.

  1. 選取哪個執行的NXT按鍵要發送"真"值並讓程式繼續執行.
    Select which NXT button will send out a “true” signal when activated and cause the program to move on.
  2. 觸碰表示該按鍵被快速地按下與釋放後啟動.按下表示該按鍵當時被按下後啟動.釋放表示該按鍵當時被釋放後啟動.
    Choose Bumped if you want the chosen button to be activated after a quick press and release. Choose Pressed if you want the chosen button to be activated at the instant the button is pressed in. Choose Released if you want the chosen button to be activated at the instant the button is released.

(內建)角度感應器
(Built-in) Rotation Sensor

Image of configuration pane for Wait - Built-in Rotation Sensor

使用"角度感應器"會讓程式在馬達旋轉一定的圈數或角度時執行.
If you choose “Rotation Sensor,” the program will advance when a motor has turned a set number of rotations or degrees.

  1. 選擇連結馬達的輸入端.
    Choose the port where your motor is plugged in.
  2. 使用單選按鍵來選擇方向:前進或後退.
    Use the radio buttons to set the direction you want: forwards or backwards.
  3. 在下拉式選單中中選擇計算圈數或度數.
    Choose to count either Rotations or Degrees by using the pull-down menu.
  4. 輸入在程式繼續執行前所需旋轉的圈數或角度.
    Type the number of rotations or degrees you want to go by before your program moves forward.
  5. 回饋區顯示現在旋轉的圈數或是角度.可用"歸零"按鍵來清空此區域.
    The feedback box will display the current number of rotations or degrees. Use the reset button to clear the feedback box.

計時器
Timer

Image of configuration pane for Wait - Timer

使用"計時器"會讓程式等待計時器達到一段時間後再執行.
If you choose “Timer,” the program will advance when one of the NXT’s internal timers reaches a certain time value.

  1. 選用NXT的計時器.
    Choose the NXT timer that you would like to monitor.
  2. 數入時間值(秒數).或是使用上下方向鍵來輸入秒數.
    Type a time value (in seconds) in the input box. You can use the arrows to increase or decrease the value.

接收訊息
Receive Message

Image of configuration pane for Wait - Receive Message

使用"接收訊息"會讓NXT等到接收特定的藍芽訊息後再執行.
If you choose “Receive Message,” the program will advance when your NXT receives a certain Bluetooth message.

  1. 在下拉式選單可以選擇接收的訊息型態(文字,數字,或是邏輯訊號).
    The pull-down menu will let you select the message type (Text, Number, or Logic) of the message that you expect to receive.
  2. 要比較接收到的訊息,得在文字或數字欄位裡分別輸入符合格式的資料.或是使用單選按鍵來做邏輯訊號的比較(真/偽).
    To compare the incoming message to a test message, either type in the test text or number (if you have chosen Text or Number respectively as the format), or use the radio buttons to choose the test logic value (true or false).
  3. 選取將透過哪個信箱號碼來接收訊息.
    Choose the mailbox number where the incoming message will arrive.

觸控*感應器
Touch* Sensor

Image of the configuration panel for the Wait-old Touch* Sensor block – callouts 1-3

使用"觸控*感應器"會讓程式在執行下一個指令之前先等待觸控*感應器的狀態:觸碰,按下,或是放開.
Choose “Touch* Sensor” and your program will wait for a touch sensor to be bumped, pressed, or released before going on the next block in your program.

  1. 選擇觸控感應器的輸入端,預設值是1號輸入端.
    Choose the port that the touch sensor is connected to. By default, the block will be set to port 1 for a touch sensor.
  2. 選擇觸控感應器的狀態:觸碰,按下,或是釋放,以讓程式繼續.觸碰表示指令會在感應器被快速地按下與釋放後繼續執行.按下表示指令會在感應器當時被按下後繼續執行.釋放表示指令會在感應器當時被釋放後繼續執行.
    Use the radio buttons to specify whether you want the touch sensor to be bumped, pressed, or released to let the program continue. Choose Bumped if you want the block to be triggered after a quick press and release of the touch sensor. Choose Pressed if you want the block to be triggered at the instant the touch sensor is pressed in. Choose Released if you want the block to be triggered at the instant the touch sensor is released.
  3. 回饋區可供測試觸控感應器.當機器人上的感應器有作用時,會顯示數字1.
    The feedback box will let you test your touch sensor. When the sensor is activated on your robot, the number 1 will be displayed here.

光源*感應器
Light* Sensor

Image of the configuration panel for the Wait-old Light* Sensor block – callouts 1-3

使用"光源*感應器"會讓程式等待某個光量達到時再執行.
Choose “Light* Sensor” and your program will wait for a light sensor to be activated by a certain intensity of light.

  1. 選擇光源感應器的輸入端,預設值是3號輸入端.
    Choose the port where your light sensor is plugged in. By default, the block will be set to port 3 for a light sensor.
  2. 使用滑桿或輸入數值來設定觸發值.右邊的單選按鈕是表示指令會在光量比觸發值高的情況下被啟動.左邊的單選按鈕表示程式會在比觸發值低的情況下被啟動.也可以使用下拉式選單來設定"真"值的滑桿位置.
    Use the slider to set the trigger value or type a value into the input box. Select the radio button to the right of the slider if you want the block to be triggered by light levels higher than the trigger value; select the left radio button to trigger the block with light levels lower than the trigger value. You can also use the pull-down menu to set the “true” portion of the slider.
  3. 回饋區顯示現在所偵測到的光量(0~100%).也可以用來測試不同的觸發值.
    The feedback box displays the current light reading (0-100%). You can use it to try out different trigger values.

角度*感應器
Rotation* Sensor

Image of configuration panel for Wait-old Rotation* Sensor – callouts 1-4

>使用"角度*感應器"會讓程式在角度*感應器旋轉到一定的滴答數(每一圈為16滴答數)時執行.
If you choose “Rotation* Sensor,” the program will advance when a rotation* sensor has turned a set number of ticks (16 per rotation).

  1. 選擇角度感應器的輸入端,預設值是2號輸入端.可以視需要而修改.
    Choose the port where your rotation sensor is plugged in. By default, the block will be set to port 2 for a rotation sensor. You can change this selection if you need to.
  2. 使用單選按鍵來選擇方向:前進或後退.
    Use the radio buttons to set the direction you want: forwards or backwards.
  3. 輸入數值當作觸發點.選擇">"符號,則在滴答數(一圈為16個滴答數)多於觸發值時會啟動,如果選擇"<"符號,則在滴答數少於觸發值時會啟動
    Set the trigger point by typing a value into the input box. Choose greater than (>) if you want the block to be triggered when the number of ticks (16 to a rotation) is more than the trigger value; choose less than (<) to trigger the block when the number of ticks is less than the trigger value.
  4. 此回饋區顯示現在計算的圈數或是滴答數.
    The feedback box will display the current number of rotations or ticks. Use the reset button to clear the feedback box.

溫度*感應器
Temperature* Sensor

Image of configuration panel for Wait-Temperature* sensor block – callouts 1-4

使用"溫度*感應器"會讓程式在達到一定的溫度時執行.
If you choose “Temperature* Sensor,” the program will advance when the temperature reaches a certain level.

  1. 選擇溫度感應器的輸入端,預設值是4號輸入端.
    Choose the port where the temperature sensor is plugged in. By default, the block will be set to port 4 for a temperature sensor.
  2. 使用滑桿或輸入數值來設定觸發值.右邊的單選按鈕是表示程式會在溫度比觸發值高的情況下被啟動.左邊的單選按鈕表示程式會在比觸發值低的情況下被啟動.也可以使用下拉式選單來設定"真"值的滑桿位置.
    Use the slider to set the trigger value or type a value directly into the input box. Select the radio button to the right of the slider if you want the block to be triggered by temperatures higher than the trigger value; select the left radio button to trigger the block with temperatures lower than the trigger value. You can also use the pull-down menu to set the “true” portion of the slider.
  3. 選擇用攝氏或是華式來讀取數值.
    Select to read values in Celsius or Fahrenheit.
  4. 此回饋區顯示現在的溫度.
    The feedback box displays the current temperature reading.

等待時間
Time

Image of the configuration pane for the Wait-Timer block

使用"等待時間"會讓程式停頓一段時間再進行下一個指令.
Choose “Time” if you want your program to hesitate for a period of time before going on to the next block.

  1. 輸入讓程式等待的秒數.也可以指定到1/10秒.(如12,3或是12.3(美制))Choose how many seconds you would like wait before the program moves on. You can specify this in 1/10s of a second (example: 12,3 or 12.3 (US)).