Debian Codegraph @

online/static/samples/Explore Atmega32/Copy INPUT A2-A7 to LED D2-D7.xml

raw symbols SCIP
1 <xml xmlns="https://developers.google.com/blockly/xml">
2 <variables>
3 <variable id="LbE2%mV/CRs,w^fwYIZy">switches</variable>
4 </variables>
5 <block type="set_reg_bits" id="|3waDCpz*X@8wo~J$=0i" x="0" y="0">
6 <field name="REGISTER">DDRA</field>
7 <field name="B7">FALSE</field>
8 <field name="B6">FALSE</field>
9 <field name="B5">FALSE</field>
10 <field name="B4">FALSE</field>
11 <field name="B3">FALSE</field>
12 <field name="B2">FALSE</field>
13 <field name="B1">FALSE</field>
14 <field name="B0">FALSE</field>
15 <next>
16 <block type="set_reg_bits_string" id="Cr|-y.+Yayrl/:Reg}ii">
17 <field name="REGISTER">PORTA</field>
18 <field name="B7">TRUE</field>
19 <field name="B6">TRUE</field>
20 <field name="B5">TRUE</field>
21 <field name="B4">TRUE</field>
22 <field name="B3">TRUE</field>
23 <field name="B2">TRUE</field>
24 <field name="B1">TRUE</field>
25 <field name="B0">TRUE</field>
26 <next>
27 <block type="set_reg_bits" id="LxL9*pOcz9p-N4de=Y|)">
28 <field name="REGISTER">DDRD</field>
29 <field name="B7">TRUE</field>
30 <field name="B6">TRUE</field>
31 <field name="B5">TRUE</field>
32 <field name="B4">TRUE</field>
33 <field name="B3">TRUE</field>
34 <field name="B2">TRUE</field>
35 <field name="B1">TRUE</field>
36 <field name="B0">TRUE</field>
37 <next>
38 <block type="controls_repeat_ext" id="%oI+O+xp08-zmsfzKoyk">
39 <value name="TIMES">
40 <shadow type="math_number" id="Pb=`jTZVX`sMgtde:KX_">
41 <field name="NUM">10000</field>
42 </shadow>
43 </value>
44 <statement name="DO">
45 <block type="variables_set" id="LfL+XY^=}JyNca24Oqdc">
46 <field name="VAR" id="LbE2%mV/CRs,w^fwYIZy">switches</field>
47 <value name="VALUE">
48 <block type="get_reg_from_string" id="NBHFr]A@6%^5?wb.VlR+">
49 <field name="REGISTER">PINA</field>
50 </block>
51 </value>
52 <next>
53 <block type="set_reg_from_string" id="MUs^k9KRmEqpZ%G%Lsjm">
54 <value name="REGISTER">
55 <block type="reg" id="@E+JO#o#~rJI?`oXF-dH">
56 <field name="REGISTER">PORTD</field>
57 </block>
58 </value>
59 <value name="VALUE">
60 <shadow type="math_number" id="D17{O4xk]JJoLP=mkZYu">
61 <field name="NUM">0</field>
62 </shadow>
63 <block type="variables_get" id="CVJft|N.SQm+BU9vkT#8">
64 <field name="VAR" id="LbE2%mV/CRs,w^fwYIZy">switches</field>
65 </block>
66 </value>
67 <next>
68 <block type="wait_seconds" id="+D2sW#zYT^DB4m(J,s]v">
69 <field name="SECONDS">0.01</field>
70 </block>
71 </next>
72 </block>
73 </next>
74 </block>
75 </statement>
76 </block>
77 </next>
78 </block>
79 </next>
80 </block>
81 </next>
82 </block>
83 <description>
84 <![CDATA[<h1>Copy states of Switches on PA2-PA7(Switch 3 to 8) to the LEDs on PD2-PD7</h1><ul><li>DDRA = 0 to set all PA pins as input type</li><li>PORTA = 255 to set internal pullup on all PA pins. This connects each input to the supply voltage of 5V through a high value resistor, so that all inputs are in HIGH state. In order to set an input to the LOW state, simply connect it to 0V(Ground) using a low value resistor, or a switch. Internal pullups ensure that in the absence of a connection to 0V, the state of the input pin is fixed and not floating. If the pullup is not provided, the pin can collect or lose stray charges and end up randomly fluctuating between LOW and HIGH states.</li><li>DDRD = 255 to set all PD pins as outputs <em>IMPORTANT</em> - PD0, PD1 are used for communicating with your phone/laptop, and cannot be altered. they will always be on unless you write C code for this task and disconnect your phone/laptop.</li></ul><p>We now with to copy the switch states to the remaining 6 LEDs continuously in a loop.</p><p><br></p><ul><li>Create a loop that repeats 10000 times.</li><li>Read PINA which contains the state of the PA pins</li><li>Copy PINA to a variable, and copy that variable to PORTD which controls the LEDs on PD pins.</li></ul>]]>
85 </description>
86 </xml>