Progetto

Generale

Profilo

File » DrawingRobot_1.1.5.beta.xml

Andrea Cimini, 14-12-2015 23:11

 
1
<project name="DrawingRobot" app="Snap4Arduino 1.0.6 beta http://s4a.cat/snap" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAD2UlEQVR4Xu3XO0qkURCA0dv4foEi+IgUwcREjEVwIYKZmYGrcAmuwG0ZGaog+ABReqbvBn6KqaZgPA0djJRVePqju2c0/vtoHgSKBEYCLJJ3tgsIUAilAgIs5XdcgBooFRBgKb/jAtRAqYAAS/kdF6AGSgUEWMrvuAA1UCogwFJ+xwWogVIBAZbyOy5ADZQKCLCU33EBaqBUQICl/I4LUAOlAgIs5XdcgBooFRBgKb/jAtRAqYAAS/kdF6AGSgUEWMrvuAA1UCogwFJ+xwWogVIBAZbyOy5ADZQKCLCU33EBaqBUQICl/I4LUAOlAgIs5XdcgBooFRBgKb/jAtRAqYAAS/kdF6AGSgUEWMrvuAA1UCogwFJ+xwWogVIBAZbyOy5ADZQKCLCU33EBaqBUQICl/I4LUAOlAgIs5XdcgBooFRBgKb/jAtRAqYAAS/kdF6AGSgUEWMrvuAAHGnh8fGybm5ttaWlJLVMQEOAA6v39fTs4OOgRzs/Pt+Xl5f5cWFhoc3NzU3hJftdKAQ683ufn5+3j46Otrq62vb29dnJy0p+Hh4dtZ2fnd9Uyhb9WgAOol5eX7eXlpX1/f/d3vo2Njf5xPDMz039z8rOLi4t2dHQ0hZfn/18pwIHX+Obmpj09PbX39/c2Ho/baDRqn5+f7fX1tf9sbW2t3d7etrOzs/+/lin8hQIcQL26umrPz8/t6+urf+ebvONN3v0m74g/Pz/939fX1/1j2SMuIMABs9PT0/b29tY/dvf393tox8fH/Tvg1tZWf0dcXFxss7OzcX2/0QQ4EMHd3V3b3d3t3/1WVlba+vp6f07+UzIJz+PfBAQ44Pfw8NC2t7d7fB75AgLMN7UxICDAAJbRfAEB5pvaGBAQYADLaL6AAPNNbQwICDCAZTRfQID5pjYGBAQYwDKaLyDAfFMbAwICDGAZzRcQYL6pjQEBAQawjOYLCDDf1MaAgAADWEbzBQSYb2pjQECAASyj+QICzDe1MSAgwACW0XwBAeab2hgQEGAAy2i+gADzTW0MCAgwgGU0X0CA+aY2BgQEGMAymi8gwHxTGwMCAgxgGc0XEGC+qY0BAQEGsIzmCwgw39TGgIAAA1hG8wUEmG9qY0BAgAEso/kCAsw3tTEgIMAAltF8AQHmm9oYEBBgAMtovoAA801tDAgIMIBlNF9AgPmmNgYEBBjAMpovIMB8UxsDAgIMYBnNFxBgvqmNAQEBBrCM5gsIMN/UxoCAAANYRvMFBJhvamNAQIABLKP5AgLMN7UxICDAAJbRfAEB5pvaGBAQYADLaL6AAPNNbQwI/AHFxSO3Jdk/bAAAAABJRU5ErkJggg==</thumbnail><stage name="Stage" width="480" height="360" costume="0" tempo="60" threadsafe="false" lines="round" codify="false" inheritance="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAOhUlEQVR4Xu3VwQkAAAjEMN1/abewn7jAQRC64wgQIECAAIF3gX1fNEiAAAECBAiMAHsCAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQIHLFxAWmhEwHPAAAAAElFTkSuQmCC</pentrails><costumes><list id="2"></list></costumes><sounds><list id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="5.724876020886768" y="-9.7077214690122" heading="90" scale="1" rotation="1" draggable="true" costume="0" color="80,80,80" pen="tip" id="8"><costumes><list id="9"></list></costumes><sounds><list id="10"></list></sounds><variables></variables><blocks></blocks><scripts><script x="30" y="10"><block s="receiveGo"></block><block s="doForever"><script><block s="digitalWrite"><l>13</l><block s="reportTrue"></block></block><block s="doWait"><l>1</l></block><block s="digitalWrite"><l>13</l><block s="reportFalse"></block></block><block s="doWait"><l>1</l></block></script></block></script><script x="17" y="181"><block s="receiveKey"><l><option>q</option></l></block><custom-block s="penup"></custom-block></script><script x="215" y="177"><block s="receiveKey"><l><option>a</option></l></block><custom-block s="pendown"></custom-block></script><script x="10" y="262"><block s="receiveKey"><l><option>up arrow</option></l></block><custom-block s="forward %s"><l>200</l></custom-block><custom-block s="done"></custom-block></script><script x="215" y="263"><block s="receiveKey"><l><option>down arrow</option></l></block><custom-block s="backward %s"><l>200</l></custom-block><custom-block s="done"></custom-block></script><script x="213" y="355"><block s="receiveKey"><l><option>right arrow</option></l></block><custom-block s="right %s"><l>360</l></custom-block><custom-block s="done"></custom-block></script><script x="15" y="361"><block s="receiveKey"><l><option>left arrow</option></l></block><custom-block s="left %s"><l>720</l></custom-block><custom-block s="done"></custom-block></script><script x="203" y="465"><block s="receiveKey"><l><option>space</option></l></block><custom-block s="init"></custom-block></script><script x="25" y="464"><block s="receiveKey"><l><option>9</option></l></block><custom-block s="testStepper"></custom-block></script><script x="607" y="83"><block s="receiveKey"><l><option>0</option></l></block><custom-block s="pendown"></custom-block><custom-block s="forward %s"><l>1000</l></custom-block><custom-block s="penup"></custom-block><custom-block s="done"></custom-block></script><script x="604" y="208"><block s="receiveKey"><l><option>t</option></l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="OLD right %s"><l>30</l></custom-block><block s="doWait"><l>3</l></block><custom-block s="done"></custom-block></script><script x="433" y="24"><block s="receiveKey"><l><option>h</option></l></block><custom-block s="pendown"></custom-block><custom-block s="left %s"><l>90</l></custom-block><custom-block s="forward %s"><l>100</l></custom-block><custom-block s="backward %s"><l>50</l></custom-block><custom-block s="right %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="left %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="backward %s"><l>100</l></custom-block><custom-block s="right %s"><l>90</l></custom-block><custom-block s="penup"></custom-block><custom-block s="forward %s"><l>25</l></custom-block><custom-block s="pendown"></custom-block><custom-block s="left %s"><l>90</l></custom-block><custom-block s="forward %s"><l>100</l></custom-block><custom-block s="right %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="right %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="right %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="backward %s"><l>50</l></custom-block><custom-block s="left %s"><l>90</l></custom-block><custom-block s="forward %s"><l>50</l></custom-block><custom-block s="left %s"><l>90</l></custom-block><custom-block s="penup"></custom-block><custom-block s="forward %s"><l>25</l></custom-block></script></scripts></sprite></sprites></stage><hidden></hidden><headers></headers><code><delim>,</delim><tempvars_delim>,</tempvars_delim><string>&quot;&lt;#1&gt;&quot;</string><doWait>delay(&lt;#1&gt; * 1000);</doWait><doForever>void loop() {&#xD;  &lt;#1&gt;&#xD;}</doForever><doRepeat>for (int i = 0; i &lt; &lt;#1&gt;; i++) {&#xD;  &lt;#2&gt;&#xD;}</doRepeat><doIf>if (&lt;#1&gt;) {&#xD;  &lt;#2&gt;&#xD;}</doIf><doIfElse>if (&lt;#1&gt;) {&#xD;  &lt;#2&gt;&#xD;} else {&#xD;  &lt;#3&gt;&#xD;}</doIfElse><reportSum>(&lt;#1&gt; + &lt;#2&gt;)</reportSum><reportDifference>(&lt;#1&gt; - &lt;#2&gt;)</reportDifference><reportProduct>(&lt;#1&gt; * &lt;#2&gt;)</reportProduct><reportQuotient>(&lt;#1&gt; / &lt;#2&gt;)</reportQuotient><reportModulus>(&lt;#1&gt; % &lt;#2&gt;)</reportModulus><reportMonadic>&lt;#1&gt;(&lt;#2&gt;)</reportMonadic><reportRandom>random(&lt;#1&gt;, &lt;#2&gt;)</reportRandom><reportLessThan>(&lt;#1&gt; &lt; &lt;#2&gt;)</reportLessThan><reportEquals>(&lt;#1&gt; == &lt;#2&gt;)</reportEquals><reportGreaterThan>(&lt;#1&gt; &gt; &lt;#2&gt;)</reportGreaterThan><reportAnd>(&lt;#1&gt; &amp;&amp; &lt;#2&gt;)</reportAnd><reportOr>(&lt;#1&gt; || &lt;#2&gt;)</reportOr><reportNot>!(&lt;#1&gt;)</reportNot><reportTrue>true</reportTrue><reportFalse>false</reportFalse><doSetVar>&lt;#1&gt; = &lt;#2&gt;;</doSetVar><doChangeVar>&lt;#1&gt; += &lt;#2&gt;;</doChangeVar><doDeclareVariables>int &lt;#1&gt;;</doDeclareVariables><reportAnalogReading>analogRead(&lt;#1&gt;)</reportAnalogReading><reportDigitalReading>digitalRead(&lt;#1&gt;)</reportDigitalReading><setPinMode>pinMode(&lt;#1&gt;, &lt;#2&gt;);</setPinMode><digitalWrite>digitalWrite(&lt;#1&gt;, &lt;#2&gt;);</digitalWrite><servoWrite>servo&lt;#1&gt;.write(&lt;#2&gt;);</servoWrite><pwmWrite>analogWrite(&lt;#1&gt;, &lt;#2&gt;);</pwmWrite></code><blocks><block-definition s="done" type="command" category="arduino"><header></header><code></code><inputs></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l></l></list><l>var L_stepper_pins = [10, 12, 13, 11];&#xD;var R_stepper_pins = [3, 5, 6, 4];&#xD;for(pin = 0; pin &lt; 4; pin++ ) &#xD;{ &#xD; this.arduino.board.pinMode(L_stepper_pins[pin],this.arduino.board.MODES.OUTPUT); &#xD; this.arduino.board.digitalWrite(L_stepper_pins[pin], this.arduino.board.MODES.LOW); &#xD; this.arduino.board.pinMode(R_stepper_pins[pin],this.arduino.board.MODES.OUTPUT); &#xD; this.arduino.board.digitalWrite(R_stepper_pins[pin], this.arduino.board.MODES.LOW); &#xD;}</l></block><list></list></block></script></block-definition><block-definition s="penup" type="command" category="arduino"><header></header><code></code><inputs></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l></l></list><l>this.arduino.board.servoWrite(8,80);</l></block><list></list></block></script></block-definition><block-definition s="pendown" type="command" category="arduino"><header></header><code></code><inputs></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l></l></list><l>this.arduino.board.servoWrite(8,170)</l></block><list></list></block></script></block-definition><block-definition s="OLD forward %&apos;distance&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>distance</l></list><l>var wheel_dia=64.5; &#xD;var wheel_base=114.5;&#xD;var steps_rev=512; &#xD;var delay_time=6; &#xD;var L_stepper_pins = [10, 12, 13, 11];&#xD;var R_stepper_pins = [3, 5, 6, 4]; &#xD;var fwd_mask =  [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; &#xD;var rev_mask =  [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; &#xD;var steps = distance * steps_rev / (wheel_dia * 3.1412);&#xD;for(step = 0; step &lt; steps; step++ ) { &#xD; for(mask = 0; mask &lt; 4; mask++ ) { &#xD; for(pin = 0; pin &lt; 4; pin++ ) { &#xD; this.arduino.board.digitalWrite(L_stepper_pins[pin], rev_mask[mask][pin]); &#xD; this.arduino.board.digitalWrite(R_stepper_pins[pin], fwd_mask[mask][pin]); &#xD; } &#xD; setTimeout(&apos;&apos;, delay_time); &#xD;} &#xD;}</l></block><list><block var="distance"/></list></block></script></block-definition><block-definition s="OLD backward %&apos;distance&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>distance</l></list><l>var wheel_dia=64.5; &#xD;var wheel_base=114.5;&#xD;var steps_rev=512; &#xD;var delay_time=6; &#xD;var L_stepper_pins = [10, 12, 13, 11];&#xD;var R_stepper_pins = [3, 5, 6, 4]; &#xD;var fwd_mask =  [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; &#xD;var rev_mask =  [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; &#xD;var steps = distance * steps_rev / (wheel_dia * 3.1412);&#xD;for(step = 0; step &lt; steps; step++ ) { &#xD; for(mask = 0; mask &lt; 4; mask++ ) { &#xD; for(pin = 0; pin &lt; 4; pin++ ) { &#xD; this.arduino.board.digitalWrite(L_stepper_pins[pin], fwd_mask[mask][pin]); &#xD; this.arduino.board.digitalWrite(R_stepper_pins[pin], rev_mask[mask][pin]); &#xD; } &#xD; setTimeout(&apos;&apos;, delay_time); &#xD;} &#xD;}</l></block><list><block var="distance"/></list></block></script></block-definition><block-definition s="OLD right %&apos;degrees&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>degrees</l></list><l>var wheel_dia=64.5; &#xD;var wheel_base=114.5;&#xD;var steps_rev=512; &#xD;var delay_time=6; &#xD;var L_stepper_pins = [10, 12, 13, 11];&#xD;var R_stepper_pins = [3, 5, 6, 4]; &#xD;var fwd_mask =  [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; &#xD;var rev_mask =  [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; &#xD;var rotation = degrees / 360;&#xD;var distance = wheel_base * 3.1412 * rotation;&#xD;var steps = distance * steps_rev / (wheel_dia * 3.1412);&#xD;for(step = 0; step &lt; steps; step++ ) { &#xD; for(mask = 0; mask &lt; 4; mask++ ) { &#xD; for(pin = 0; pin &lt; 4; pin++ ) { &#xD; this.arduino.board.digitalWrite(R_stepper_pins[pin], rev_mask[mask][pin]); &#xD; this.arduino.board.digitalWrite(L_stepper_pins[pin], rev_mask[mask][pin]); &#xD; } &#xD; setTimeout(&apos;&apos;, delay_time); &#xD;} &#xD;}</l></block><list><block var="degrees"/></list></block></script></block-definition><block-definition s="OLD left %&apos;degrees&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>degrees</l></list><l>var wheel_dia=64.5; &#xD;var wheel_base=114.5;&#xD;var steps_rev=512; &#xD;var delay_time=6; &#xD;var L_stepper_pins = [10, 12, 13, 11];&#xD;var R_stepper_pins = [3, 5, 6, 4]; &#xD;var fwd_mask =  [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; &#xD;var rev_mask =  [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; &#xD;var rotation = degrees / 360;&#xD;var distance = wheel_base * 3.1412 * rotation;&#xD;var steps = distance * steps_rev / (wheel_dia * 3.1412);&#xD;for(step = 0; step &lt; steps; step++ ) { &#xD; for(mask = 0; mask &lt; 4; mask++ ) { &#xD; for(pin = 0; pin &lt; 4; pin++ ) { &#xD; this.arduino.board.digitalWrite(R_stepper_pins[pin], fwd_mask[mask][pin]); &#xD; this.arduino.board.digitalWrite(L_stepper_pins[pin], fwd_mask[mask][pin]); &#xD; } &#xD; setTimeout(&apos;&apos;, delay_time); &#xD;} &#xD;}</l></block><list><block var="degrees"/></list></block></script></block-definition><block-definition s="testStepper" type="command" category="arduino"><header></header><code></code><inputs></inputs><script><block s="doDeclareVariables"><list><l>done</l></list></block><block s="doSetVar"><l>done</l><block s="reportNewList"><list><l></l></list></block></block><block s="doRun"><block s="reportJSFunction"><list><l>done</l></list><l>	// private static constants
2
&#xD;								var STEPPER = 0x72								
3
&#xD;								CONFIG = 0,								
4
&#xD;								STEP = 1,
5
&#xD;								DRV_4WIRE = 0x04,
6
&#xD;								MAX_STEPS = 2097151, // 21 bits (2^21 - 1) 
7
&#xD;								MAX_SPEED = 16383, // 14 bits (2^14 - 1)
8
&#xD;								stepper1_directionPin = 3,
9
&#xD;								stepper1_stepPin = 5,
10
&#xD;								stepper1_motorPin3 = 6,
11
&#xD;								stepper1_motorPin4 = 4,	
12
&#xD;								stepper2_directionPin = 10,
13
&#xD;								stepper2_stepPin = 12,
14
&#xD;								stepper2_motorPin3 = 13,
15
&#xD;								stepper2_motorPin4 = 11,	
16
&#xD;								CLOCKWISE = 0,
17
&#xD;								COUNTER_CLOCKWISE = 1;&#xD;
18
								
19
&#xD;								var numStepsPerRev = 64;&#xD;								var numStepsPerRevLSB = numStepsPerRev &amp; 0x007F,&#xD;
20
							numStepsPerRevMSB = (numStepsPerRev &gt;&gt; 7) &amp; 0x007F;&#xD;
21
&#xD;								var numSteps = 1050; //3700 x 1 giro di 360°&#xD;								var steps = [
22
&#xD;									Math.abs(numSteps) &amp; 0x0000007F,&#xD; 								(Math.abs(numSteps) &gt;&gt; 7) &amp; 0x0000007F,&#xD;									(Math.abs(numSteps) &gt;&gt; 14) &amp; 0x0000007F&#xD;								];&#xD;
23
&#xD;        var speed = 30; //(1-50)
24
&#xD;								speed = Math.floor(speed.toFixed(2) * 100);&#xD;
25
							var speedLSB = speed &amp; 0x007F;&#xD;								var speedMSB = (speed &gt;&gt; 7) &amp; 0x007F;&#xD;								
26
&#xD;								//this.arduino.board.pinMode(directionPin, this.arduino.board.MODES.OUTPUT);
27
&#xD;								//this.arduino.board.pinMode(stepPin, this.arduino.board.MODES.OUTPUT);&#xD;
28
							//this.arduino.board.pinMode(motorPin3, this.arduino.board.MODES.OUTPUT);&#xD;								//this.arduino.board.pinMode(motorPin4, this.arduino.board.MODES.OUTPUT);								&#xD;
29
&#xD;								//this.arduino.board.sp.write(new Buffer([0xF0,STEPPER,CONFIG,0,DRV_4WIRE,numStepsPerRevLSB,numStepsPerRevMSB,stepper1_directionPin,stepper1_stepPin,stepper1_motorPin3,stepper1_motorPin4,0xF7])); 
30
&#xD;        //this.arduino.board.sp.write(new Buffer([0xF0,STEPPER,CONFIG,1,DRV_4WIRE,numStepsPerRevLSB,numStepsPerRevMSB,stepper2_directionPin,stepper2_stepPin,stepper2_motorPin3,stepper2_motorPin4,0xF7]));&#xD;  
31
					//this.arduino.board.sp.write(new Buffer([0xF0,STEPPER,STEP,0,COUNTER_CLOCKWISE,steps[0],steps[1],steps[2],speedLSB,speedMSB,0xF7]));&#xD; 
32
						//this.arduino.board.sp.write(new Buffer([0xF0,STEPPER,STEP,1,CLOCKWISE,steps[0],steps[1],steps[2],speedLSB,speedMSB,0xF7]));&#xD;        &#xD;        var index = 0;&#xD;&#xD;        var doneCallback0 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        var doneCallback1 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;        &#xD;        //this.arduino.board.stepperConfig(0, DRV_4WIRE, 64, stepper1_directionPin, stepper1_stepPin, stepper1_motorPin3, stepper1_motorPin4);&#xD;        //this.arduino.board.stepperConfig(1, DRV_4WIRE, 64, stepper2_directionPin, stepper2_stepPin, stepper2_motorPin3, stepper2_motorPin4);        &#xD;&#xD;        this.arduino.board.stepperStep(0, CLOCKWISE, 1000, 4000, doneCallback0);					&#xD;        this.arduino.board.stepperStep(1, CLOCKWISE, 1000, 4000, doneCallback1);
33
&#xD;								</l></block><list><block var="done"/></list></block><block s="doWaitUntil"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><block var="done"/></block><l>2</l></block></block></script></block-definition><block-definition s="init" type="command" category="arduino"><header></header><code></code><inputs></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l></l></list><l>								var DRV_4WIRE = 0x04,
34
&#xD; 							stepper0_directionPin = 6,
35
&#xD;								stepper0_stepPin = 4,
36
&#xD;								stepper0_motorPin3 = 5,
37
&#xD;								stepper0_motorPin4 = 3,	
38
&#xD;								stepper1_directionPin = 13,
39
&#xD;								stepper1_stepPin = 11,
40
&#xD;								stepper1_motorPin3 = 12,
41
&#xD;								stepper1_motorPin4 = 10,	
42
&#xD;        servo_pin = 8,&#xD;								CLOCKWISE = 0,
43
&#xD;								COUNTER_CLOCKWISE = 1,
44
								
45
&#xD;								numStepsForRev = 64;&#xD;&#xD;        this.arduino.board.pinMode(servo_pin, this.arduino.board.MODES.SERVO);&#xD;        &#xD;        this.arduino.board.stepperConfig(0, DRV_4WIRE, numStepsForRev, stepper0_directionPin, stepper0_stepPin, stepper0_motorPin3, stepper0_motorPin4);&#xD;        this.arduino.board.stepperConfig(1, DRV_4WIRE, numStepsForRev, stepper1_directionPin, stepper1_stepPin, stepper1_motorPin3, stepper1_motorPin4);        &#xD;								</l></block><list><l></l></list></block></script></block-definition><block-definition s="forward %&apos;distance&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>done</l></list></block><block s="doSetVar"><l>done</l><block s="reportNewList"><list><l></l></list></block></block><block s="doRun"><block s="reportJSFunction"><list><l>done</l><l>distance</l></list><l>        var CCW = 0,
46
&#xD;        CW = 1;&#xD;&#xD;        var steps_rev = 4076/2;&#xD;        var wheel_dia = 64.5;&#xD;
47
								
48

    
49
&#xD;        var steps = distance * steps_rev / (wheel_dia * 3.141592654); //24.61								&#xD;
50
&#xD;        var index = 0;&#xD;&#xD;        var doneCallback0 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        var doneCallback1 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        this.arduino.board.stepperStep(0, CW, steps, 4000, 4000, 8000, doneCallback0);					&#xD;        this.arduino.board.stepperStep(1, CCW, steps, 4000, 4000, 8000, doneCallback1);
51
								</l></block><list><block var="done"/><block var="distance"/></list></block><block s="doWaitUntil"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><block var="done"/></block><l>2</l></block></block></script></block-definition><block-definition s="backward %&apos;distance&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>done</l></list></block><block s="doSetVar"><l>done</l><block s="reportNewList"><list><l></l></list></block></block><block s="doRun"><block s="reportJSFunction"><list><l>done</l><l>distance</l></list><l>        var CCW = 0,
52
&#xD;        CW = 1;&#xD;
53
								
54

    
55
&#xD;								var steps_rev = 4076/2;
56
&#xD;        var wheel_dia = 64.5;
57
&#xD;        var steps = distance * steps_rev / (wheel_dia * 3.141592654); //24.61								&#xD;
58
&#xD;        var index = 0;&#xD;&#xD;        var doneCallback0 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        var doneCallback1 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        this.arduino.board.stepperStep(0, CCW, steps, 4000, 4000, 8000, doneCallback0);					&#xD;        this.arduino.board.stepperStep(1, CW, steps, 4000, 4000, 8000, doneCallback1);
59
								</l></block><list><block var="done"/><block var="distance"/></list></block><block s="doWaitUntil"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><block var="done"/></block><l>2</l></block></block></script></block-definition><block-definition s="left %&apos;degrees&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>done</l></list></block><block s="doSetVar"><l>done</l><block s="reportNewList"><list><l></l></list></block></block><block s="doRun"><block s="reportJSFunction"><list><l>done</l><l>degrees</l></list><l>								var CCW = 0,
60
&#xD;								CW = 1;&#xD;
61
								
62

    
63
&#xD;								var steps_rev = 4076/2;
64
&#xD;        var wheel_dia = 64.5;
65
&#xD;        var wheel_base = 115;
66
&#xD;        var rotation = degrees / 360.0;
67
&#xD;        var distance = wheel_base * 3.141592654 * rotation;
68
&#xD;        var steps = distance * steps_rev / (wheel_dia * 3.141592654); //24.61								&#xD;
69
&#xD;        var index = 0;&#xD;&#xD;        var doneCallback0 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        var doneCallback1 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        this.arduino.board.stepperStep(0, CW, steps, 4000, 4000, 8000, doneCallback0);					&#xD;        this.arduino.board.stepperStep(1, CW, steps, 4000, 4000, 8000, doneCallback1);
70
								</l></block><list><block var="done"/><block var="degrees"/></list></block><block s="doWaitUntil"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><block var="done"/></block><l>2</l></block></block></script></block-definition><block-definition s="right %&apos;degrees&apos;" type="command" category="arduino"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>done</l></list></block><block s="doSetVar"><l>done</l><block s="reportNewList"><list><l></l></list></block></block><block s="doRun"><block s="reportJSFunction"><list><l>done</l><l>degrees</l></list><l>        var CCW = 0,
71
&#xD;        CW = 1;&#xD;
72
								
73

    
74
&#xD;								var steps_rev = 4076/2;
75
&#xD;        var wheel_dia = 64.5;&#xD;        var wheel_base = 115;&#xD;        var rotation = degrees / 360.0;&#xD;        var distance = wheel_base * 3.141592654 * rotation;
76
&#xD;        var steps = distance * steps_rev / (wheel_dia * 3.141592654); //24.61								&#xD;
77
&#xD;        var index = 0;&#xD;&#xD;        var doneCallback0 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        var doneCallback1 = function () {&#xD;           done.add(++index);&#xD;        }&#xD;&#xD;        this.arduino.board.stepperStep(0, CCW, steps, 4000, 4000, 8000, doneCallback0);					&#xD;        this.arduino.board.stepperStep(1, CCW, steps, 4000, 4000, 8000, doneCallback1);
78
								</l></block><list><block var="done"/><block var="degrees"/></list></block><block s="doWaitUntil"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><block var="done"/></block><l>2</l></block></block></script></block-definition></blocks><variables></variables></project>
(31-31/38)