<xml xmlns="https://developers.google.com/blockly/xml">
  <variables>
    <variable id="J:_q@wiv_(TjW-,ALBHb">inp</variable>
  </variables>
  <block type="set_reg_bits_string" id="xg-=5J6@QrTuhaUVD{4!" x="14" y="141">
    <field name="REGISTER">DDRA</field>
    <field name="B7">TRUE</field>
    <field name="B6">TRUE</field>
    <field name="B5">TRUE</field>
    <field name="B4">TRUE</field>
    <field name="B3">TRUE</field>
    <field name="B2">TRUE</field>
    <field name="B1">FALSE</field>
    <field name="B0">FALSE</field>
    <next>
      <block type="set_reg_bits_string" id="1,ocAyLI,I3N;_1=b#.0">
        <field name="REGISTER">DDRB</field>
        <field name="B7">FALSE</field>
        <field name="B6">FALSE</field>
        <field name="B5">FALSE</field>
        <field name="B4">FALSE</field>
        <field name="B3">TRUE</field>
        <field name="B2">TRUE</field>
        <field name="B1">TRUE</field>
        <field name="B0">TRUE</field>
        <next>
          <block type="controls_whileUntil" id="p3(X2h$a}K#kGagwmq9h">
            <field name="MODE">WHILE</field>
            <value name="BOOL">
              <shadow type="logic_boolean" id="VzX^zho!8uvnIPT})UH$">
                <field name="BOOL">TRUE</field>
              </shadow>
            </value>
            <statement name="DO">
              <block type="variables_set" id="Z9+@byodUfBK{j7Kh}2@">
                <field name="VAR" id="J:_q@wiv_(TjW-,ALBHb">inp</field>
                <value name="VALUE">
                  <block type="get_reg_from_string" id="r^Q#=/u!_TS2;:f,Bt=r">
                    <field name="REGISTER">PINA</field>
                  </block>
                </value>
                <next>
                  <block type="controls_if" id="{*_YG-Jx3of++GNY-Hig">
                    <mutation elseif="2" else="1"></mutation>
                    <value name="IF0">
                      <block type="logic_compare" id="P]uc{.)[KA!I5Ph3(J{t">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get" id=":3M~Csml%K7sp6lfX.x8">
                            <field name="VAR" id="J:_q@wiv_(TjW-,ALBHb">inp</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="math_number" id="[Ii~B^a/V`{`B_dxUZ9a">
                            <field name="NUM">0</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="cs_sticker" id="d92Vtz7TP)(Z]~cy}B}?">
                        <value name="LABEL">
                          <shadow type="text" id="q(w*{kz8OD!D@E(77A2Z">
                            <field name="TEXT">status</field>
                          </shadow>
                        </value>
                        <value name="TEXT">
                          <shadow type="text" id="8hTu#1#yjt(o-[LY=R8=">
                            <field name="TEXT">move forward </field>
                          </shadow>
                        </value>
                        <next>
                          <block type="set_reg_bits_string" id="~i%-:M]pMvLA,~LT4e}M">
                            <field name="REGISTER">PORTB</field>
                            <field name="B7">FALSE</field>
                            <field name="B6">FALSE</field>
                            <field name="B5">FALSE</field>
                            <field name="B4">FALSE</field>
                            <field name="B3">TRUE</field>
                            <field name="B2">FALSE</field>
                            <field name="B1">TRUE</field>
                            <field name="B0">FALSE</field>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <value name="IF1">
                      <block type="logic_compare" id="5QQU{@Go9P3U=SuV)o1.">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get" id="*WpG1)m-_~?g8b,A#t{]">
                            <field name="VAR" id="J:_q@wiv_(TjW-,ALBHb">inp</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="math_number" id="+Xs+;pRx_K{iP_%,o#!E">
                            <field name="NUM">1</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO1">
                      <block type="cs_sticker" id="U3?OSmzb1MfGR8EwWl$F">
                        <value name="LABEL">
                          <shadow type="text" id="OpF}7H(anQUAIO[eGgoG">
                            <field name="TEXT">status</field>
                          </shadow>
                        </value>
                        <value name="TEXT">
                          <shadow type="text" id="2QcU|(}S`wLtr-@S$i/*">
                            <field name="TEXT">turn left</field>
                          </shadow>
                        </value>
                        <next>
                          <block type="set_reg_bits_string" id="x}JPKFJ-Mg.YEa}1^gD`">
                            <field name="REGISTER">PORTB</field>
                            <field name="B7">FALSE</field>
                            <field name="B6">FALSE</field>
                            <field name="B5">FALSE</field>
                            <field name="B4">FALSE</field>
                            <field name="B3">TRUE</field>
                            <field name="B2">FALSE</field>
                            <field name="B1">FALSE</field>
                            <field name="B0">TRUE</field>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <value name="IF2">
                      <block type="logic_compare" id="GL6||MfLW9~h5^TG@V=!">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get" id="?dx4,;JyEI)|E7~H^#lV">
                            <field name="VAR" id="J:_q@wiv_(TjW-,ALBHb">inp</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="math_number" id="_~?LD{JQQJa+QVx$EXkO">
                            <field name="NUM">2</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO2">
                      <block type="cs_sticker" id="/;mu03q/$ABT#doun@z3">
                        <value name="LABEL">
                          <shadow type="text" id="#A6y?DLmCg[{51/g?~Q|">
                            <field name="TEXT">status</field>
                          </shadow>
                        </value>
                        <value name="TEXT">
                          <shadow type="text" id="o3L|]7lATb6;rR-0YQpf">
                            <field name="TEXT">turn right</field>
                          </shadow>
                        </value>
                        <next>
                          <block type="set_reg_bits_string" id="-0]+L[*!6}1-2jSN;B%Y">
                            <field name="REGISTER">PORTB</field>
                            <field name="B7">FALSE</field>
                            <field name="B6">FALSE</field>
                            <field name="B5">FALSE</field>
                            <field name="B4">FALSE</field>
                            <field name="B3">FALSE</field>
                            <field name="B2">TRUE</field>
                            <field name="B1">TRUE</field>
                            <field name="B0">FALSE</field>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <statement name="ELSE">
                      <block type="cs_sticker" id="OQXx3EI^}BxvPH3T69Dx">
                        <value name="LABEL">
                          <shadow type="text" id="EMIu`7SUgLJ=a;|#s+gF">
                            <field name="TEXT">status</field>
                          </shadow>
                        </value>
                        <value name="TEXT">
                          <shadow type="text" id="[HhMc=SdJv:^I%Rak,O+">
                            <field name="TEXT">Signal lost</field>
                          </shadow>
                        </value>
                        <next>
                          <block type="set_reg_bits_string" id="oy[Ti#|UoRWqoq-Qh}Kk">
                            <field name="REGISTER">PORTB</field>
                            <field name="B7">FALSE</field>
                            <field name="B6">FALSE</field>
                            <field name="B5">FALSE</field>
                            <field name="B4">FALSE</field>
                            <field name="B3">FALSE</field>
                            <field name="B2">FALSE</field>
                            <field name="B1">FALSE</field>
                            <field name="B0">FALSE</field>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <next>
                      <block type="wait_seconds" id="Y(oV@bo8`t`b+-%d@%gU">
                        <field name="SECONDS">0.02</field>
                        <next>
                          <block type="set_reg_bits_string" id="S+nW:Q^,k4PymBb-h~=N">
                            <field name="REGISTER">PORTB</field>
                            <field name="B7">FALSE</field>
                            <field name="B6">FALSE</field>
                            <field name="B5">FALSE</field>
                            <field name="B4">FALSE</field>
                            <field name="B3">FALSE</field>
                            <field name="B2">FALSE</field>
                            <field name="B1">FALSE</field>
                            <field name="B0">FALSE</field>
                            <next>
                              <block type="wait_seconds" id="OQ=a.(%!#zY$w9owY5C;">
                                <field name="SECONDS">0.05</field>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </statement>
            <next>
              <block type="set_reg_bits_string" id="a8IPfT!Y4[3bMp-`}$/)">
                <field name="REGISTER">PORTB</field>
                <field name="B7">FALSE</field>
                <field name="B6">FALSE</field>
                <field name="B5">FALSE</field>
                <field name="B4">FALSE</field>
                <field name="B3">FALSE</field>
                <field name="B2">FALSE</field>
                <field name="B1">FALSE</field>
                <field name="B0">FALSE</field>
              </block>
            </next>
          </block>
        </next>
      </block>
    </next>
  </block>
<description>
<![CDATA[<h1>Automatically Scan and allow the user to select a sensor</h1><p><br></p><p>In this experiment we shall use a user input block which scans the I2C port for supported sensors, and shows the user a list of detected sensors to select from.</p><p><br></p><p>The parameters supported by the selected Sensor are automatically fed into the adjacent drop-down menu for the user to select.</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><h2>connections for I2C sensors</h2><p><br></p><p>Sensors which use the I2C communication interface require 4 connections to be made.</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><ul><li>VCC ( Can be 5V or 3.3V). The 4 wire sensor cable has 5V, and most commonly available sensors have a 3.3V regulator on board to convert the voltage .</li><li>GND . Ground</li><li>SCl. Clock pin. Internally pulled up to 3.3V via 10K resistor</li><li>SDA . Data . Internally pulled up to 3.3V via 10K</li></ul><p>*If the sensor chip itself operates at 5V(INA219, some boards of QMC5883L etc), the pull up should be to 5V , or else communication errors will occur. To do this, connect a 2K resistor each from SCL to 5V, and from SDA to 5V (this can be done on the SCL,SDA,5V pins located at the top right side of the 40*2 connector of SEELab)</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><h2>Recording data</h2><p><img src="data:image/jpeg;base64,[encoded data, 77512 characters]"></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><ol><li>Click the scan I2C button</li><li>Select from the list of detected sensors*</li><li>Select the parameter you wish to record</li><li>Click on RUN!</li></ol><p><br></p><p>* The device is able to obtain the list of I2C addresses which have responded during the scan. The names of the sensors are then guessed based on a predefined map of sensors and their commonly known addresses.</p><p>If 2 sensors are known to be sold with the same address, both will be shown to the user in the list (e.g., TCS34725 and VL53L0X are sold with address=41) . Choose accordingly.</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><h2>Configuration options</h2><p><br></p><p>Some sensors have additional configurations, and multiple parameters to choose from.</p><p><img src="data:image/jpeg;base64,[encoded data, 48620 characters]"></p><p><br></p><p>E.g., the MPU6050 allows choosing the input ranges of the accelerometer and gyroscope. Click on the configure option, and select the required range before starting acquisition.</p><p>It also has 6 parameters to choose from : acceleration along 3 axes, and angular velocity along 3 axes</p><p><br></p><p>For the TSL2561 LUMINOSITY sensor, 2 options, IR, full spectrum are available. One is chosen and logged in the first picture.</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><h2>Recording a thermocouple's voltage with ADS1115 16-bit ADC</h2><p><br></p><iframe class="ql-video" frameborder="0" allowfullscreen="true" src="https://www.youtube.com/embed/NyA2bcWTmzw?showinfo=0"></iframe><p><br></p>]]>
</description>
</xml>