1
|
<project name="DrawingRobot" app="Snap4Arduino 1.0.6 beta http://s4a.cat/snap" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAADoklEQVR4Xu3VTUqyARTF8SvayD4oQbKIqMDIqQiuoWVETlpF4zbgHgSh9bSFBhF9OIiyNxfgO/NwDv9n5EC4957z43kay39P8ZCAKIEGAEXJM3aVAACBIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgNL4GQ5ADEgTAKA0foYDEAPSBAAojZ/hAMSANAEASuNnOAAxIE0AgGvin06n1el06uLioi4vL2t7e1taVuJwAK5p9ebmpprNZvV6vdrf36/d3d3V77Ozszo6Oqq9vb1EExu9CYBr4p7P5/X4+Fjv7+/18vJSrVarTk5O6vz8vLrd7uqN+Afz+vp6o6UlDQPgf9q8u7ur5+fn+v7+ruVyufr319dXvb6+1tvbW/X7/ZrNZkkmNnoLANfE/fT0VA8PD6u332KxqEajUTs7O6s339+n+efnp46Pj+v+/n6jpSUNA+CaNieTSX18fNTW1lZ9fn5Wu92uq6urGo1GNRgM6vDwMMmC5BYAron99va2Tk9Pazgc1ng8roODA0lJyUMBmNyuwW0ANCgpeUUAJrdrcBsADUpKXhGAye0a3AZAg5KSVwRgcrsGtwHQoKTkFQGY3K7BbQA0KCl5RQAmt2twGwANSkpeEYDJ7RrcBkCDkpJXBGByuwa3AdCgpOQVAZjcrsFtADQoKXlFACa3a3AbAA1KSl4RgMntGtwGQIOSklcEYHK7BrcB0KCk5BUBmNyuwW0ANCgpeUUAJrdrcBsADUpKXhGAye0a3AZAg5KSVwRgcrsGtwHQoKTkFQGY3K7BbQA0KCl5RQAmt2twGwANSkpeEYDJ7RrcBkCDkpJXBGByuwa3AdCgpOQVAZjcrsFtADQoKXlFACa3a3AbAA1KSl4RgMntGtwGQIOSklcEYHK7BrcB0KCk5BUBmNyuwW0ANCgpeUUAJrdrcBsADUpKXhGAye0a3NYw2JEVgxP4BZADHLtwT2bLAAAAAElFTkSuQmCC</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="2.5390215264174816" y="-10.344892367906086" 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="29"><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="200"><block s="receiveKey"><l><option>q</option></l></block><custom-block s="penup"></custom-block></script><script x="215" y="196"><block s="receiveKey"><l><option>a</option></l></block><custom-block s="pendown"></custom-block></script><script x="10" y="281"><block s="receiveKey"><l><option>up arrow</option></l></block><custom-block s="forward %s"><l>1000</l></custom-block><custom-block s="done"></custom-block></script><script x="215" y="282"><block s="receiveKey"><l><option>down arrow</option></l></block><custom-block s="backward %s"><l>1000</l></custom-block><custom-block s="done"></custom-block></script><script x="213" y="374"><block s="receiveKey"><l><option>right arrow</option></l></block><custom-block s="right %s"><l>1000</l></custom-block><custom-block s="done"></custom-block></script><script x="15" y="380"><block s="receiveKey"><l><option>left arrow</option></l></block><custom-block s="left %s"><l>1000</l></custom-block><custom-block s="done"></custom-block></script><script x="495" y="54"><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="203" y="484"><block s="receiveKey"><l><option>space</option></l></block><custom-block s="init"></custom-block></script><script x="25" y="483"><block s="receiveKey"><l><option>9</option></l></block><custom-block s="testStepper"></custom-block></script><script x="514" y="384"><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></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.pinMode(8,this.arduino.board.MODES.SERVO);
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
|