<xml xmlns="https://developers.google.com/blockly/xml">
  <block type="set_color" id="archaeology_bone_start_light" x="180" y="60">
    <field name="color_option">'white'</field>
    <next>
      <block type="transmit" id="archaeology_bone_start_message">
        <value name="for_print">
          <block type="text" id="archaeology_bone_start_text">
            <field name="TEXT">Starting the archaeological search...</field>
          </block>
        </value>
        <next>
          <block type="wait" id="archaeology_bone_sensor_wait">
            <field name="wait_s">1</field>
            <next>
              <block type="controls_whileUntil" id="archaeology_bone_search_loop">
                <field name="MODE">UNTIL</field>
                <value name="BOOL">
                  <block type="logic_compare" id="archaeology_bone_distance_check">
                    <field name="OP">LT</field>
                    <value name="A">
                      <block type="distance" id="archaeology_bone_distance_sensor"></block>
                    </value>
                    <value name="B">
                      <block type="math_number" id="archaeology_bone_distance_limit">
                        <field name="NUM">10</field>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO">
                  <block type="move_forward_distance" id="archaeology_bone_two_cm_step">
                    <field name="number_of_steps">2</field>
                  </block>
                </statement>
                <next>
                  <block type="stop" id="archaeology_bone_stop">
                    <next>
                      <block type="set_color" id="archaeology_bone_alert_light">
                        <field name="color_option">'red'</field>
                        <next>
                          <block type="beep" id="archaeology_bone_alert_sound">
                            <next>
                              <block type="transmit" id="archaeology_bone_found_message">
                                <value name="for_print">
                                  <block type="text_join" id="archaeology_bone_message_join">
                                    <mutation items="3"></mutation>
                                    <value name="ADD0">
                                      <block type="text" id="archaeology_bone_message_text">
                                        <field name="TEXT">Archaeological bone detected at </field>
                                      </block>
                                    </value>
                                    <value name="ADD1">
                                      <block type="distance" id="archaeology_bone_final_distance"></block>
                                    </value>
                                    <value name="ADD2">
                                      <block type="text" id="archaeology_bone_message_unit">
                                        <field name="TEXT"> cm. Stop and document the finding.</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
    </next>
  </block>
  <project>
    <title>We are archaeologists - Bone detection</title>
    <description>Advance straight in 2 cm sections and stop approximately 10 cm before the raised archaeological bone detected by the ultrasonic sensor</description>
  </project>
</xml>
