1
|
<project name="DrawingRobot" app="Snap4Arduino 1.0.6 beta http://s4a.cat/snap" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAADqElEQVR4Xu3XO0qkYRCG0a/xkileEEVRQUQMBNdh7BJMjNyAuDUXoOJKxMRQYWb6DyZtii54Yeb8WUN1FZ5+aOzZrz/P8BAICcwEGJJ3dhIQoBCiAgKM8jsuQA1EBQQY5XdcgBqICggwyu+4ADUQFRBglN9xAWogKiDAKL/jAtRAVECAUX7HBaiBqIAAo/yOC1ADUQEBRvkdF6AGogICjPI7LkANRAUEGOV3XIAaiAoIMMrvuAA1EBUQYJTfcQFqICogwCi/4wLUQFRAgFF+xwWogaiAAKP8jgtQA1EBAUb5HRegBqICAozyOy5ADUQFBBjld1yAGogKCDDK77gANRAVEGCU33EBaiAqIMAov+MC1EBUQIBRfscFqIGogACj/I4LUANRAQFG+R0XoAaiAgKM8jsuQA1EBQQY5XdcgBqICggwyu+4ADUQFRBglN9xAWogKiDABfxvb29jd3d3HB8fj9XV1eiH9S8eF+CCT/Xx8XEcHh6O/f39sbGxMXZ2dsbe3t4U5fy1ZzkBAS7wu729HZ+fn+Pr62uK7+LiYlxdXY3Ly8txcHAwVlZWpjg3NzeX+yT+03cLcMEH//r6Ou7u7sbJyclYW1sbs9lsfH9/T0F+fHxM4T09PY2bm5v/NKHl/mwBLvB7eXmZAjw9PZ0CnD8/Pz8CXK67v+8W4ALIh4eH8f7+PkW3tbU1fROenZ2No6Oj6dtvHuX19fX02lMXEOACs/v7++l/vPX19bG9vT2FNv82nP8qnv8Q8SwnIMAFfs/Pz9OPjfPz8ylCT6+AAHs9bSsKCLAIZrxXQIC9nrYVBQRYBDPeKyDAXk/bigICLIIZ7xUQYK+nbUUBARbBjPcKCLDX07aigACLYMZ7BQTY62lbUUCARTDjvQIC7PW0rSggwCKY8V4BAfZ62lYUEGARzHivgAB7PW0rCgiwCGa8V0CAvZ62FQUEWAQz3isgwF5P24oCAiyCGe8VEGCvp21FAQEWwYz3Cgiw19O2ooAAi2DGewUE2OtpW1FAgEUw470CAuz1tK0oIMAimPFeAQH2etpWFBBgEcx4r4AAez1tKwoIsAhmvFdAgL2ethUFBFgEM94rIMBeT9uKAgIsghnvFRBgr6dtRQEBFsGM9woIsNfTtqKAAItgxnsFBNjraVtRQIBFMOO9AgLs9bStKCDAIpjxXgEB9nraVhQQYBHMeK+AAHs9bSsKCLAIZrxXQIC9nrYVBQRYBDPeKyDAXk/bigK/AZ8OGrc4T98eAAAAAElFTkSuQmCC</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.724876020886831" y="-9.70772146901216" 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>100</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>100</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>360</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>"<#1>"</string><doWait>delay(<#1> * 1000);</doWait><doForever>void loop() {
 <#1>
}</doForever><doRepeat>for (int i = 0; i < <#1>; i++) {
 <#2>
}</doRepeat><doIf>if (<#1>) {
 <#2>
}</doIf><doIfElse>if (<#1>) {
 <#2>
} else {
 <#3>
}</doIfElse><reportSum>(<#1> + <#2>)</reportSum><reportDifference>(<#1> - <#2>)</reportDifference><reportProduct>(<#1> * <#2>)</reportProduct><reportQuotient>(<#1> / <#2>)</reportQuotient><reportModulus>(<#1> % <#2>)</reportModulus><reportMonadic><#1>(<#2>)</reportMonadic><reportRandom>random(<#1>, <#2>)</reportRandom><reportLessThan>(<#1> < <#2>)</reportLessThan><reportEquals>(<#1> == <#2>)</reportEquals><reportGreaterThan>(<#1> > <#2>)</reportGreaterThan><reportAnd>(<#1> && <#2>)</reportAnd><reportOr>(<#1> || <#2>)</reportOr><reportNot>!(<#1>)</reportNot><reportTrue>true</reportTrue><reportFalse>false</reportFalse><doSetVar><#1> = <#2>;</doSetVar><doChangeVar><#1> += <#2>;</doChangeVar><doDeclareVariables>int <#1>;</doDeclareVariables><reportAnalogReading>analogRead(<#1>)</reportAnalogReading><reportDigitalReading>digitalRead(<#1>)</reportDigitalReading><setPinMode>pinMode(<#1>, <#2>);</setPinMode><digitalWrite>digitalWrite(<#1>, <#2>);</digitalWrite><servoWrite>servo<#1>.write(<#2>);</servoWrite><pwmWrite>analogWrite(<#1>, <#2>);</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];
var R_stepper_pins = [3, 5, 6, 4];
for(pin = 0; pin < 4; pin++ ) 
{ 
 this.arduino.board.pinMode(L_stepper_pins[pin],this.arduino.board.MODES.OUTPUT); 
 this.arduino.board.digitalWrite(L_stepper_pins[pin], this.arduino.board.MODES.LOW); 
 this.arduino.board.pinMode(R_stepper_pins[pin],this.arduino.board.MODES.OUTPUT); 
 this.arduino.board.digitalWrite(R_stepper_pins[pin], this.arduino.board.MODES.LOW); 
}</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 %'distance'" 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; 
var wheel_base=114.5;
var steps_rev=512; 
var delay_time=6; 
var L_stepper_pins = [10, 12, 13, 11];
var R_stepper_pins = [3, 5, 6, 4]; 
var fwd_mask = [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; 
var rev_mask = [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; 
var steps = distance * steps_rev / (wheel_dia * 3.1412);
for(step = 0; step < steps; step++ ) { 
 for(mask = 0; mask < 4; mask++ ) { 
 for(pin = 0; pin < 4; pin++ ) { 
 this.arduino.board.digitalWrite(L_stepper_pins[pin], rev_mask[mask][pin]); 
 this.arduino.board.digitalWrite(R_stepper_pins[pin], fwd_mask[mask][pin]); 
 } 
 setTimeout('', delay_time); 
} 
}</l></block><list><block var="distance"/></list></block></script></block-definition><block-definition s="OLD backward %'distance'" 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; 
var wheel_base=114.5;
var steps_rev=512; 
var delay_time=6; 
var L_stepper_pins = [10, 12, 13, 11];
var R_stepper_pins = [3, 5, 6, 4]; 
var fwd_mask = [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; 
var rev_mask = [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; 
var steps = distance * steps_rev / (wheel_dia * 3.1412);
for(step = 0; step < steps; step++ ) { 
 for(mask = 0; mask < 4; mask++ ) { 
 for(pin = 0; pin < 4; pin++ ) { 
 this.arduino.board.digitalWrite(L_stepper_pins[pin], fwd_mask[mask][pin]); 
 this.arduino.board.digitalWrite(R_stepper_pins[pin], rev_mask[mask][pin]); 
 } 
 setTimeout('', delay_time); 
} 
}</l></block><list><block var="distance"/></list></block></script></block-definition><block-definition s="OLD right %'degrees'" 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; 
var wheel_base=114.5;
var steps_rev=512; 
var delay_time=6; 
var L_stepper_pins = [10, 12, 13, 11];
var R_stepper_pins = [3, 5, 6, 4]; 
var fwd_mask = [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; 
var rev_mask = [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; 
var rotation = degrees / 360;
var distance = wheel_base * 3.1412 * rotation;
var steps = distance * steps_rev / (wheel_dia * 3.1412);
for(step = 0; step < steps; step++ ) { 
 for(mask = 0; mask < 4; mask++ ) { 
 for(pin = 0; pin < 4; pin++ ) { 
 this.arduino.board.digitalWrite(R_stepper_pins[pin], rev_mask[mask][pin]); 
 this.arduino.board.digitalWrite(L_stepper_pins[pin], rev_mask[mask][pin]); 
 } 
 setTimeout('', delay_time); 
} 
}</l></block><list><block var="degrees"/></list></block></script></block-definition><block-definition s="OLD left %'degrees'" 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; 
var wheel_base=114.5;
var steps_rev=512; 
var delay_time=6; 
var L_stepper_pins = [10, 12, 13, 11];
var R_stepper_pins = [3, 5, 6, 4]; 
var fwd_mask = [[1, 0, 1, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1]]; 
var rev_mask = [[1, 0, 0, 1], [0, 1, 0, 1], [0, 1, 1, 0], [1, 0, 1, 0]]; 
var rotation = degrees / 360;
var distance = wheel_base * 3.1412 * rotation;
var steps = distance * steps_rev / (wheel_dia * 3.1412);
for(step = 0; step < steps; step++ ) { 
 for(mask = 0; mask < 4; mask++ ) { 
 for(pin = 0; pin < 4; pin++ ) { 
 this.arduino.board.digitalWrite(R_stepper_pins[pin], fwd_mask[mask][pin]); 
 this.arduino.board.digitalWrite(L_stepper_pins[pin], fwd_mask[mask][pin]); 
 } 
 setTimeout('', delay_time); 
} 
}</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
|