1 – Mit Fahrroboter einen Parcours fahren

1

Mit Fahrroboter einen Parcours fahren

Das lernst du hier

Lasse deinen Roboter einen vorgegebenen Parcours fahren: starte mit einem einfachen Quadrat und dann einem Slalom oder einem Kreis. Schaffst du es, dass dein Roboter in eine Parklücke rückwärts einparken kann?

Roboter fährt Quadrat
Roboter fährt Slalom
1a

Ein Quadrat oder einen Slalom fahren

Wie geht das?

Das Fahren eines Parcours wird über die Zeit in Millisekunden (ms) gesteuert. Es funktioniert also gleich, wie das Kochen eines Menus nach Rezept:

> Fahre geradeaus
> Tue nichts weiteres, während 1000ms
> Drehe nach links
> tue nichts weiteres, während 500ms
> Fahre geradeaus
> und so weiter …

Roboter fährt Quadrat

Challenge:

Challenge einfach: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="*:3e.esi^B`J%$5)X12H">Zeit in ms</variable><variable id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</variable><variable id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</variable><variable id="QmpV861a}-ED`kw_!OUj">End-Tempo</variable><variable id="lO0ZYE*d3-TBXT4=/F%w">LED</variable><variable id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</variable><variable id="?~`j6li~gz]E9ASa.KQP">Anzahl</variable><variable id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</variable><variable id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</variable><variable id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</variable><variable id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</variable><variable id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</variable></variables><block type="basic_comment" id="Y/%+*oQh84;{RYh4B(M#" x="99" y="-609"><field name="COMMENT">Unterprogramme für die Fahrfunktionen: nicht löschen</field></block><block type="basic_comment" id="VqL}4}2k,Ds[ivNf7qzU" x="1533" y="-648"><field name="COMMENT">FAHRROBOTER Challenge 1a "erweitert"&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, kannst&amp;#10;du mit einem Rechtsklick oder ctrl-c, ctrl-v Kopien erzeugen</field></block><block type="procedures_defnoreturn" id="B_Djb,XT!DZg^~PzkcLj" collapsed="true" x="100" y="-545"><mutation><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">fahre immer gerade, bis ein anderer Fahrbefehl kommt</field><statement name="STACK"><block type="motor_write_percentage" id="CVgdsF_Ciz2#cSa1Uzkr"><value name="MOTOR"><block type="motor_pin" id="fxi0wOX+xO0pLjR2Um4C"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="4sXfoCfhnC(ydw4TBM@@"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="Zc}Ba3k4rN]c44=t/$52"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="w*_UOiM8M_uZkC7HNM7b"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="_[vZA74*R~$5vB~.B{sw"><value name="MOTOR"><block type="motor_pin" id="=X*8FmY]Iffj+CPn)xt."><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="Yt3k/a{3aSZSt6v5gEi!"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="!T1Y;Ym~c*iG`0BjHDCH"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id=":]Y8VlHDYWg}0#.k*i7n"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value></block></next></block></statement></block><block type="procedures_defnoreturn" id="7idn+zmBV^05K)?dbrX2" collapsed="true" x="101" y="-501"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">fahre gerade</field><statement name="STACK"><block type="motor_write_percentage" id="CX9lDgiJue@Wp%^M:8Y_"><value name="MOTOR"><block type="motor_pin" id="C2kSMb#UFwi:A-ycmz-$"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="|KjW,*;bXO}e-]tbAwLu"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="AL^NrcuqJ9jn^+:.^64l"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="g.4j{{Yw%YzRS@2.RR@q"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="`*9P$I8h7l7unf;uuDUY"><value name="MOTOR"><block type="motor_pin" id="NgfnW}QwW/Sub{E{drVB"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="O8u6QjR*T6/s;`6p@QJg"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="0$J(kR_T+NlL-Zx`.H_m"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="-Y{5|/R]n2#_ZiiG=ukk"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value><next><block type="flow_delay" id="$UEwm}*UK,)O^n3[i+uI"><value name="DELAY"><block type="variables_get" id="8cp[Ha9+)6(45R8Ea94,"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_callnoreturn" id="Zn/FvMYk*7jx-!px[2zv" x="875" y="-534"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="fOUgB91o^b*x|W8w[xw1"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="D7,~^b,6G@#(b|_6H{Mt"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="b$ZY,afDLca(n96G6dI/" collapsed="true" x="102" y="-459"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">drehe rechts</field><statement name="STACK"><block type="motor_write_percentage" id="SC3Vb^~=}0G^Vf(W]0Ut"><value name="MOTOR"><block type="motor_pin" id="O!N8lS^4K.v=zr#l(7_?"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="variables_get" id="({oJFj@/Un`20Vq[/Nu9"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><next><block type="motor_write_percentage" id="JX0cn1WV)iib(C#d2r*+"><value name="MOTOR"><block type="motor_pin" id="bEM[LV6.O*JA,#(2@eAe"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_single_basic" id="I8?+tyfP,,S=U2(J4f8)"><field name="OP">NEG</field><value name="NUM"><block type="variables_get" id="o]9*O`O0)xdqIA8pk]!{"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value></block></value><next><block type="flow_delay" id="}|w]BVgUtOIS~t:hvsM{"><value name="DELAY"><block type="variables_get" id="Yom)S?%MT|X/9$j_.9ZX"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="basic_main_loop" id="G*CnBl/}.#[Uu3$r65YB" deletable="false" x="1535" y="-528"><value name="BLINK"><block type="basic_blinkcode" id="dNza0.A_^`:Gp@0E_6sk"><field name="SHORT">1</field><field name="LONG">1</field></block></value></block><block type="procedures_callnoreturn" id="[TP2I(#RMWXrM@/:J.j@" x="876" y="-459"><mutation name="drehe rechts"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="nzkzz5Rn;6pcaF,#^ErQ"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="5:brD?jZ3[-m:;zY-{kc"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="#;_5#6Swhgm#)6$rs/`7" collapsed="true" x="103" y="-413"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">drehe links</field><statement name="STACK"><block type="motor_write_percentage" id="lm*;)+^AODwf;u6NRo6T"><value name="MOTOR"><block type="motor_pin" id="~Aw#)pqDmD#W[{mM=b?l"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_single_basic" id="X+%.H2wRzBaugs8Tg@BZ"><field name="OP">NEG</field><value name="NUM"><block type="variables_get" id="/NYNXzSb_uYJ,lImtmjy"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value></block></value><next><block type="motor_write_percentage" id="Jx}1%or79[7115hz.W5t"><value name="MOTOR"><block type="motor_pin" id="1w-f|QjK}dA$?UG]l9_{"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="variables_get" id="uLu.#62J{x:~Rq1ZM3N`"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><next><block type="flow_delay" id="!|dN{0*B-IuAiY3u/ydB"><value name="DELAY"><block type="variables_get" id="4@d=mE/zr{b~[Pm#d65j"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="kB`@8{W4N]8a62og=X,/" collapsed="true" x="102" y="-362"><mutation><arg name="Start-Tempo" varid="LxkGe)=JaZ:.FWq%8/{%"></arg><arg name="End-Tempo" varid="QmpV861a}-ED`kw_!OUj"></arg><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg></mutation><field name="NAME">beschleunige gerade</field><statement name="STACK"><block type="flow_for" id="K7zxz_2AdWC:ro~hE3UG"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field><value name="FROM"><block type="variables_get" id="EEJ.wGG?Rf(]T3G.Q$-Y"><field name="VAR" id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</field></block></value><value name="TO"><block type="variables_get" id="Yh+)1DFZH~t3~$7b|+~V"><field name="VAR" id="QmpV861a}-ED`kw_!OUj">End-Tempo</field></block></value><value name="BY"><block type="math_arithmetic" id="w=)4r,$8s)w0i5Z9]slP"><field name="OP">DIVIDE</field><value name="A"><block type="math_single_basic" id="J}GFmoMcj2jrV1n}34r@"><field name="OP">ABS</field><value name="NUM"><block type="math_arithmetic" id="eAHQK#478Zr04L#%zXVX"><field name="OP">MINUS</field><value name="A"><block type="variables_get" id="lGKl.z?bO3QA`3?|Vxpf"><field name="VAR" id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</field></block></value><value name="B"><block type="variables_get" id="E9SalBeRLNa6]tv)-12f"><field name="VAR" id="QmpV861a}-ED`kw_!OUj">End-Tempo</field></block></value></block></value></block></value><value name="B"><block type="variables_get" id="`kEE9ROpCT![N%}p6;u8"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></value><statement name="DO"><block type="motor_write_percentage" id="aO6!Re;~6y,48$4i`GJ^"><value name="MOTOR"><block type="motor_pin" id="8LgGxImN)|1r8a[IXGI1"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="#}=-G#;oVZ=.e61^9bt%"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="z5,:.g90Hf{sh(KZw$Km"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="HHDgjtii1nJ%W.JtfV25"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="O=0KkQ]6fGYHQ)2@Pz}="><value name="MOTOR"><block type="motor_pin" id="~_}-G3=@D5^X:%RKG7u."><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="K2{7*QDhtAn{2}-WD/%d"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="@vp;6/WSb~=i^MhS=S-r"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="I/JOS)4%CyQan/3:iUAf"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value><next><block type="flow_delay" id=";lzYQKjlTTZqDc/_4:^m"><value name="DELAY"><block type="math_number" id="z3s(n37Bs{Hy/5[9LV!A"><field name="NUM">1</field></block></value></block></next></block></next></block></statement></block></statement></block><block type="procedures_callnoreturn" id="$`347Mu.zr?u6er*B.J=" x="876" y="-379"><mutation name="drehe links"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="agn||YCF+(c,}`)g}_32"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="7vk+H8b.5JynBsa7/eiH"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="*2`6*YJKnt%=!hvULK)i" collapsed="true" x="101" y="-317"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg></mutation><field name="NAME">stoppe</field><statement name="STACK"><block type="motor_write_percentage" id="E|],,BqSrLd9@{yC;9Tl"><value name="MOTOR"><block type="motor_pin" id="WqAs2=rW5usmc%/1YGCP"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="#Uq}-VfY@VR(AgmJUbka"><field name="NUM">0</field></block></value><next><block type="motor_write_percentage" id="D5Vx`5TgSaKxMtd*=;c6"><value name="MOTOR"><block type="motor_pin" id="#q1Mj6*B0z4nQpm53QrG"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="9`Jq(CJP-z8v@RbaiLpX"><field name="NUM">0</field></block></value><next><block type="flow_delay" id="D;Oe@ky+Qf:ab7[b^qC%"><value name="DELAY"><block type="variables_get" id="*7c5;7=kM8(_T_.4J1Xz"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="D?8m~{UZEw,gRWJ=lyrt" collapsed="true" x="101" y="-271"><field name="NAME">stoppe bis Sensor 1 oder 2 berührt werden</field><statement name="STACK"><block type="flow_until" id="LK(cABcMVespL,%xl[I;"><value name="CONDITION"><block type="logic_operation" id="V6,O|T(Mm+Pa=5|GSI;O"><field name="OP">OR</field><value name="A"><block type="sensor_test_state" id="k$)Xq$(Th.l(np;6l%(W"><field name="MODE">STANDARD</field><value name="SENSOR"><block type="sensor_pin" id="4:2cV=t#v|y*ns:57|pk"><field name="SENSOR">SENSOR1</field></block></value><value name="STATE"><block type="basic_digital_state" id="^Z!2?Q2fU{W#*2QjXb|B"><field name="STATE">LOW</field></block></value></block></value><value name="B"><block type="sensor_test_state" id="VN9EtrJK+|Y,~cl([_?A"><field name="MODE">STANDARD</field><value name="SENSOR"><block type="sensor_pin" id="90K_jtZ(.ed,2iG%|X~!"><field name="SENSOR">SENSOR2</field></block></value><value name="STATE"><block type="basic_digital_state" id="CoMqFe6[PDLh.Hh`Q{yH"><field name="STATE">LOW</field></block></value></block></value></block></value><statement name="DO"><block type="motor_write_percentage" id="8hy}9/~4vU]~)O%)iI44"><value name="MOTOR"><block type="motor_pin" id="fD%R*49Zq3eeRUj.dI4{"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="+DlNfo+sED)Zf]/dbhO)"><field name="NUM">0</field></block></value><next><block type="motor_write_percentage" id=":C:t@)w5[q.*7bQ^,D*{"><value name="MOTOR"><block type="motor_pin" id="N!dR[Rpyg}t8U18N9`b9"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="Mxo-NI/L`L|*K@L_MT3}"><field name="NUM">0</field></block></value></block></next></block></statement></block></statement></block><block type="procedures_defnoreturn" id="teqdL;Xne}3_$#5acQG1" collapsed="true" x="102" y="-224"><mutation><arg name="LED" varid="lO0ZYE*d3-TBXT4=/F%w"></arg><arg name="Intervall in ms" varid="0z{{*X:B1%h{p$#~9jog"></arg><arg name="Anzahl" varid="?~`j6li~gz]E9ASa.KQP"></arg></mutation><field name="NAME">blinke</field><statement name="STACK"><block type="flow_repeat" id="84;0;QCkVHG[hWb6S;jk"><value name="REPEATS"><block type="variables_get" id="[(%4+5h?#NVufzwMm=PU"><field name="VAR" id="?~`j6li~gz]E9ASa.KQP">Anzahl</field></block></value><statement name="DO"><block type="led_write_state" id="Q#r$V/4}goLh4JCARX2t"><value name="LED"><block type="variables_get" id="Ie(zgrcCcG@akugpkI0X"><field name="VAR" id="lO0ZYE*d3-TBXT4=/F%w">LED</field></block></value><value name="VALUE"><block type="basic_digital_state" id="9UbkEDc8XOV-=Gp:_sv2"><field name="STATE">LOW</field></block></value><next><block type="flow_delay" id="22HE}R^VvW-2eQDVm4rJ"><value name="DELAY"><block type="variables_get" id="UFVbmq{CWS_-A!Cl!*ir"><field name="VAR" id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</field></block></value><next><block type="led_write_state" id="sax*9,CvXy*]nL~T?12;"><value name="LED"><block type="variables_get" id="!qIT15TscM_85X+q#EeE"><field name="VAR" id="lO0ZYE*d3-TBXT4=/F%w">LED</field></block></value><value name="VALUE"><block type="basic_digital_state" id="uSl_cJOh~$TP,|tPH]ja"><field name="STATE">HIGH</field></block></value><next><block type="flow_delay" id=")~B2viE[QaJ,l`.SaQy:"><value name="DELAY"><block type="variables_get" id="DN~]AhE``r`IlVz/A=|}"><field name="VAR" id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</field></block></value></block></next></block></next></block></next></block></statement></block></statement></block><block type="basic_comment" id=":f]r6`23+VV(tZ+IB$-w" x="881" y="-217"><field name="COMMENT">Funktionen für Erweiterungen:&amp;#10;&gt; lasse den Roboter beim Start langsam beschleunigen&amp;#10;&gt; lasse den Roboter langsam abbremsen, bevor er etwas neues macht&amp;#10;&gt; lasse den Roboter bei Programmstart erst losfahren, wenn du einen Sensor berührt hast</field></block><block type="procedures_defreturn" id="1{95fOK|YQj$):Ye?tzx" collapsed="true" x="103" y="-175"><field name="NAME">Gemessene Distanz in cm mit Ultraschallsensor an S3</field><statement name="STACK"><block type="led_write_state" id="D.Aw@M=~$.grAnuObBbh"><value name="LED"><block type="led_pin" id="/?Hx;.FZ0Z:~,P`Y_Iy+"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="EGCbx{pK#/c0)bpQ1S$:"><field name="STATE">LOW</field></block></value><next><block type="flow_delay_micro" id="~vi$Q8|t,ieh9x9{,-}j"><value name="DELAY_MICRO"><block type="math_number" id="0F!T(vR({+A.e4t)+)eq"><field name="NUM">5</field></block></value><next><block type="led_write_state" id="a~{7Z*qj}GBpctRT.n[Y"><value name="LED"><block type="led_pin" id="etDp;!3hx*ZAv(vgedP?"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="yCl~sepJMya+Vn})_+LN"><field name="STATE">HIGH</field></block></value><next><block type="flow_delay_micro" id="(7IH(q}Ufp3QMa]A#_hx"><value name="DELAY_MICRO"><block type="math_number" id="d~5}kTDbC:~nW9weO=[m"><field name="NUM">10</field></block></value><next><block type="led_write_state" id="4;ge?pcgEgn;zTr%4*|b"><value name="LED"><block type="led_pin" id="rr[C%~Z~,d}t(rKdpVNO"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="E9vmv$q}|S@0eWRLa6v."><field name="STATE">LOW</field></block></value><next><block type="flow_while" id="J46#ClY#8iAC|d9sd[D7"><value name="CONDITION"><block type="logic_compare" id="2$H]yr/vzffF7_*NaCF`"><field name="OP">EQ</field><value name="A"><block type="sensor_read_state" id="QS.D0VHOBqgW?XtRvDhV"><value name="SENSOR"><block type="sensor_pin" id="FIKu6*CWMd%^n@%;^KPq"><field name="SENSOR">SENSOR3</field></block></value></block></value><value name="B"><block type="basic_digital_state" id="-|ZQEDJ,%tpzxHWoszw_"><field name="STATE">LOW</field></block></value></block></value><next><block type="variables_set" id="8H6mMsf:00(JgN8#9~kY"><field name="VAR" id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</field><value name="VALUE"><block type="flow_micro" id="uFTPzVQjA.:7?574Dz+S"></block></value><next><block type="flow_while" id="0+JWcX7${c/V1agz~{~~"><value name="CONDITION"><block type="logic_compare" id="O7#zdEPJy/Z$|BTFpZnu"><field name="OP">EQ</field><value name="A"><block type="sensor_read_state" id="p8::;:/2c9C72N:/Z+q("><value name="SENSOR"><block type="sensor_pin" id="w-[7Bh]ve|c1!{$T94/0"><field name="SENSOR">SENSOR3</field></block></value></block></value><value name="B"><block type="basic_digital_state" id="zKa(1}|0Z-piFkA$e)7X"><field name="STATE">HIGH</field></block></value></block></value><next><block type="variables_set" id=")+y.m%pPfDM$GPWR/5`}"><field name="VAR" id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</field><value name="VALUE"><block type="math_arithmetic" id="|ZG9t6SFEv9Hk^Bwwk6["><field name="OP">MINUS</field><value name="A"><block type="flow_micro" id="dP6IOW}qTd@+^-0}R1Ym"></block></value><value name="B"><block type="variables_get" id="xS2=qGUJ;~_DUY:{-P[G"><field name="VAR" id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</field></block></value></block></value><next><block type="variables_set" id="tz1MO],0y*wAVS)|*)Y?"><field name="VAR" id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</field><value name="VALUE"><block type="math_arithmetic" id=")[DkL;,Uxl/SZD;Hn}7v"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="#uxi(=)]|Ai)(s:+aqA5"><field name="VAR" id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</field></block></value><value name="B"><block type="math_number" id="r?Kb;9IssvYq(JJ^Ilt="><field name="NUM">0.0175</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement><value name="RETURN"><block type="variables_get" id="3bEb2ZLsqp!xXU!g}7N/"><field name="VAR" id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</field></block></value></block><block type="basic_comment" id="Z.T%z)$q/PQeHgiys?X/" x="106" y="-119"><field name="COMMENT">Dein Roboter fährt nicht schön geradeaus, weil ein Motor langsamer läuft?&amp;#10;******************************************************************************&amp;#10;Korrigiere die Motoren hier durch Verlangsamen eines Rades!&amp;#10;Reduziere dazu den Korrekturfaktor z.B. auf 0.95, um ein bestimmtes Rad zu verlangsamen&amp;#10;&amp;#10;M1 &lt; links rechts &gt; M2</field></block><block type="procedures_callnoreturn" id="cwSHM=}?FF#Qrtf{-f+g" x="883" y="-85"><mutation name="beschleunige gerade"><arg name="Start-Tempo"></arg><arg name="End-Tempo"></arg><arg name="Zeit in ms"></arg></mutation><value name="ARG0"><block type="math_number" id="?`+,n4.IVFCU[a0TegLc"><field name="NUM">0</field></block></value><value name="ARG1"><block type="math_number" id="!IwDVS~))1):!/RZRNl)"><field name="NUM">100</field></block></value><value name="ARG2"><block type="math_number" id="sZEb#Uz=1ybP3u}(NOaU"><field name="NUM">1000</field></block></value></block><block type="expert_setup" id="n`^X=a^-s/deQxv!gyOB" x="108" y="32"><statement name="CODE"><block type="variables_set" id="ogoAs~nAQ@y./_;{#*L`"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field><value name="VALUE"><block type="math_number" id="Wu3sirdS,Cy+Hx]eyb_}"><field name="NUM">1</field></block></value><next><block type="variables_set" id="$}2$uF4PGhI~$^d,HXmq"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field><value name="VALUE"><block type="math_number" id="Dd7O+]Cw_+DO-K$Xp;W0"><field name="NUM">1</field></block></value></block></next></block></statement></block><block type="procedures_callnoreturn" id="LKPNUtr%-DAtt`wNPQHC" x="884" y="-8"><mutation name="stoppe"><arg name="Zeit in ms"></arg></mutation><value name="ARG0"><block type="math_number" id="aZe(riw:;_fF_!;@%6_y"><field name="NUM">1000</field></block></value></block><block type="procedures_callnoreturn" id="Bkg(,(KXsej.z,4~cNCK" x="885" y="67"><mutation name="stoppe bis Sensor 1 oder 2 berührt werden"></mutation></block></xml>
Challenge erweitert: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><block type="basic_comment" id="/11t(ikP@^J4;Y^tMv}(" x="1052" y="-164"><field name="COMMENT">FAHRROBOTER Challenge 1a "erweitert"&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, findest du sie im Menu</field></block><block type="basic_comment" id="Amw$%u:tCFOIg0gFR]I^" x="1051" y="-71"><field name="COMMENT">Erweiterungen:&amp;#10;&gt; Der Drehpunkt des Roboters befindet sich in der Mitte des Chassis. Ändere das Programm so, dass sich der Drehpunkt über&amp;#10;   dem inneren Rad der Drehung befindet.&amp;#10;&gt; Beschleunige einen Motor langsam mit einer zähle-von-bis Schleife: workshop.pglu.ch &gt; Sketch &gt; zähle-von-bis-alle&amp;#10;&gt; Vereinfache das Programm, indem du eigene Fahrfunktionen programmierst: workshop.pglu.ch &gt; Sketch &gt; Funktion</field></block><block type="basic_comment" id="/wmu/CoXGZ:eMSrwXH,X" x="703" y="72"><field name="COMMENT">fahre geradeaus</field></block><block type="basic_main_loop" id="8Np#B)0Vf^SF*=TW~5k/" deletable="false" x="1055" y="69"><value name="BLINK"><block type="basic_blinkcode" id="W.$!O{rF:YlxA}+Dr!t+"><field name="SHORT">1</field><field name="LONG">1</field></block></value></block><block type="motor_write_percentage" id="$L=qJ~FODf%Y)3]^r;x@" x="705" y="132"><value name="MOTOR"><block type="motor_pin" id="XYNBU!.bOz)waUV*p?Du"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="r=B:4[jhJydGW*NXsgde"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id=".y+0|?Pp0HH6/!eKoZV_"><value name="MOTOR"><block type="motor_pin" id="3k|N4p^^OKP;*4l^O3to"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="qO2)R]O`!C9}va.%t?t5"><field name="NUM">100</field></block></value></block></next></block><block type="basic_comment" id="H5Q^bZd:y1cc=P*Uj/8N" x="709" y="244"><field name="COMMENT">drehe rechts</field></block><block type="motor_write_percentage" id="nEKDy?+x)/W0dux1Sgk_" x="707" y="296"><value name="MOTOR"><block type="motor_pin" id="w7J)Q[;#-QLw|`f.DCL#"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="7=$Z0$aCas)ZYya~=CeZ"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id="KMPK!FfQHy!J5=U^C3OM"><value name="MOTOR"><block type="motor_pin" id=";`WglE8Y{$n2j+VW:{Fl"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="@_C.:T.R=PQs[_5R8{K/"><field name="NUM">-100</field></block></value></block></next></block><block type="basic_comment" id="0x[yuU,z17N,Le]$c;I:" x="709" y="408"><field name="COMMENT">drehe links</field></block><block type="motor_write_percentage" id="r!Hso-aO/~gDn}`[!UXF" x="712" y="469"><value name="MOTOR"><block type="motor_pin" id="X|oY5%9)wD5zCLI#xJ*d"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="4CZy!PAXl|q.D5rpumvU"><field name="NUM">-100</field></block></value><next><block type="motor_write_percentage" id="fkav%5a=Gqq}qA/A!o/)"><value name="MOTOR"><block type="motor_pin" id="$+*6~lkGoYs2%}Pk#3n="><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="A~r`n?}5h0gsi/6Cn]52"><field name="NUM">100</field></block></value></block></next></block><block type="basic_comment" id="Bljv0-WJv2RJM_6)+}P_" x="715" y="585"><field name="COMMENT">pausiere das Programm</field></block><block type="flow_delay" id=":xT7y6B;~{i,yF6DlCmZ" x="716" y="641"><value name="DELAY"><block type="math_number" id="`,h.zBj-s0##Q2@w+iJ3"><field name="NUM">1000</field></block></value></block></xml>

Mögliche Lösung:

Lösung einfach: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="*:3e.esi^B`J%$5)X12H">Zeit in ms</variable><variable id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</variable><variable id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</variable><variable id="QmpV861a}-ED`kw_!OUj">End-Tempo</variable><variable id="lO0ZYE*d3-TBXT4=/F%w">LED</variable><variable id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</variable><variable id="?~`j6li~gz]E9ASa.KQP">Anzahl</variable><variable id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</variable><variable id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</variable><variable id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</variable><variable id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</variable><variable id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</variable></variables><block type="basic_comment" id="Y/%+*oQh84;{RYh4B(M#" x="99" y="-609"><field name="COMMENT">Unterprogramme für die Fahrfunktionen: nicht löschen</field></block><block type="basic_comment" id="VqL}4}2k,Ds[ivNf7qzU" x="1533" y="-648"><field name="COMMENT">FAHRROBOTER Challenge 1a "erweitert"&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, kannst&amp;#10;du mit einem Rechtsklick oder ctrl-c, ctrl-v Kopien erzeugen</field></block><block type="procedures_defnoreturn" id="B_Djb,XT!DZg^~PzkcLj" collapsed="true" x="100" y="-545"><mutation><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">fahre immer gerade, bis ein anderer Fahrbefehl kommt</field><statement name="STACK"><block type="motor_write_percentage" id="CVgdsF_Ciz2#cSa1Uzkr"><value name="MOTOR"><block type="motor_pin" id="fxi0wOX+xO0pLjR2Um4C"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="4sXfoCfhnC(ydw4TBM@@"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="Zc}Ba3k4rN]c44=t/$52"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="w*_UOiM8M_uZkC7HNM7b"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="_[vZA74*R~$5vB~.B{sw"><value name="MOTOR"><block type="motor_pin" id="=X*8FmY]Iffj+CPn)xt."><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="Yt3k/a{3aSZSt6v5gEi!"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="!T1Y;Ym~c*iG`0BjHDCH"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id=":]Y8VlHDYWg}0#.k*i7n"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value></block></next></block></statement></block><block type="procedures_defnoreturn" id="7idn+zmBV^05K)?dbrX2" collapsed="true" x="101" y="-501"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">fahre gerade</field><statement name="STACK"><block type="motor_write_percentage" id="CX9lDgiJue@Wp%^M:8Y_"><value name="MOTOR"><block type="motor_pin" id="C2kSMb#UFwi:A-ycmz-$"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="|KjW,*;bXO}e-]tbAwLu"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="AL^NrcuqJ9jn^+:.^64l"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="g.4j{{Yw%YzRS@2.RR@q"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="`*9P$I8h7l7unf;uuDUY"><value name="MOTOR"><block type="motor_pin" id="NgfnW}QwW/Sub{E{drVB"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="O8u6QjR*T6/s;`6p@QJg"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="0$J(kR_T+NlL-Zx`.H_m"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="-Y{5|/R]n2#_ZiiG=ukk"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value><next><block type="flow_delay" id="$UEwm}*UK,)O^n3[i+uI"><value name="DELAY"><block type="variables_get" id="8cp[Ha9+)6(45R8Ea94,"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_callnoreturn" id="Zn/FvMYk*7jx-!px[2zv" x="875" y="-534"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="fOUgB91o^b*x|W8w[xw1"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="D7,~^b,6G@#(b|_6H{Mt"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="b$ZY,afDLca(n96G6dI/" collapsed="true" x="102" y="-459"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">drehe rechts</field><statement name="STACK"><block type="motor_write_percentage" id="SC3Vb^~=}0G^Vf(W]0Ut"><value name="MOTOR"><block type="motor_pin" id="O!N8lS^4K.v=zr#l(7_?"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="variables_get" id="({oJFj@/Un`20Vq[/Nu9"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><next><block type="motor_write_percentage" id="JX0cn1WV)iib(C#d2r*+"><value name="MOTOR"><block type="motor_pin" id="bEM[LV6.O*JA,#(2@eAe"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_single_basic" id="I8?+tyfP,,S=U2(J4f8)"><field name="OP">NEG</field><value name="NUM"><block type="variables_get" id="o]9*O`O0)xdqIA8pk]!{"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value></block></value><next><block type="flow_delay" id="}|w]BVgUtOIS~t:hvsM{"><value name="DELAY"><block type="variables_get" id="Yom)S?%MT|X/9$j_.9ZX"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="basic_main_loop" id="G*CnBl/}.#[Uu3$r65YB" deletable="false" x="1535" y="-528"><value name="BLINK"><block type="basic_blinkcode" id="dNza0.A_^`:Gp@0E_6sk"><field name="SHORT">1</field><field name="LONG">1</field></block></value><statement name="CODE"><block type="procedures_callnoreturn" id="h!liE/cf8qV5P9Qt1Lje"><mutation name="stoppe bis Sensor 1 oder 2 berührt werden"></mutation><next><block type="procedures_callnoreturn" id="s+Sl5,;G/5MyPyd|9u3R"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="CuS_gqm_r6Tfgo9qPQ6_"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="}Hp{CRy01oYI@mYRKfo!"><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="SrR^$KA;qfkzD,u5GV_v"><mutation name="drehe links"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="ej=jrO^[^R$X2d2l8LJ*"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="=*;3u#G[DE2hC12FAzb9"><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="7d57Fuw~RMQ8eUhJ-Z{E"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="2?VU~:0QT3V#5aFKsV}i"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="X.`LVdo%3]:n$7]s@Pli"><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="={`xC~Yl|r/v%e(5)hY2"><mutation name="drehe links"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="s#oW4cXRE?Z~n/Rx5d[F"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="l661-yea]XKtp^CNT41-"><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="X.$ZgF.:K$bP_W*/BJjW"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="k(-u8_*nn-Z^t)p.QJP}"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="*lvI[9MZSoATIC(oe@K="><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="^*rv5Yd.rr8gs-xwJuJi"><mutation name="drehe links"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="v:J]Sd}pxRc0Cd?L!Y9;"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="H.-clvMD+5x^X5yX^*:*"><field name="NUM">100</field></block></value><next><block type="procedures_callnoreturn" id="Ayo*3-kb/%(.s0;0J8B_"><mutation name="fahre gerade"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="2k$7E,P7SO5a{1kVEz5M"><field name="NUM">1000</field></block></value><value name="ARG1"><block type="math_number" id="d.ScM:`U|3=e3+-D87l6"><field name="NUM">100</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="procedures_callnoreturn" id="[TP2I(#RMWXrM@/:J.j@" x="876" y="-459"><mutation name="drehe rechts"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="nzkzz5Rn;6pcaF,#^ErQ"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="5:brD?jZ3[-m:;zY-{kc"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="#;_5#6Swhgm#)6$rs/`7" collapsed="true" x="103" y="-413"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg><arg name="Tempo in %" varid="s4FBJ~ulwwAj1J|RD1|@"></arg></mutation><field name="NAME">drehe links</field><statement name="STACK"><block type="motor_write_percentage" id="lm*;)+^AODwf;u6NRo6T"><value name="MOTOR"><block type="motor_pin" id="~Aw#)pqDmD#W[{mM=b?l"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_single_basic" id="X+%.H2wRzBaugs8Tg@BZ"><field name="OP">NEG</field><value name="NUM"><block type="variables_get" id="/NYNXzSb_uYJ,lImtmjy"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value></block></value><next><block type="motor_write_percentage" id="Jx}1%or79[7115hz.W5t"><value name="MOTOR"><block type="motor_pin" id="1w-f|QjK}dA$?UG]l9_{"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="variables_get" id="uLu.#62J{x:~Rq1ZM3N`"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><next><block type="flow_delay" id="!|dN{0*B-IuAiY3u/ydB"><value name="DELAY"><block type="variables_get" id="4@d=mE/zr{b~[Pm#d65j"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="kB`@8{W4N]8a62og=X,/" collapsed="true" x="102" y="-362"><mutation><arg name="Start-Tempo" varid="LxkGe)=JaZ:.FWq%8/{%"></arg><arg name="End-Tempo" varid="QmpV861a}-ED`kw_!OUj"></arg><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg></mutation><field name="NAME">beschleunige gerade</field><statement name="STACK"><block type="flow_for" id="K7zxz_2AdWC:ro~hE3UG"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field><value name="FROM"><block type="variables_get" id="EEJ.wGG?Rf(]T3G.Q$-Y"><field name="VAR" id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</field></block></value><value name="TO"><block type="variables_get" id="Yh+)1DFZH~t3~$7b|+~V"><field name="VAR" id="QmpV861a}-ED`kw_!OUj">End-Tempo</field></block></value><value name="BY"><block type="math_arithmetic" id="w=)4r,$8s)w0i5Z9]slP"><field name="OP">DIVIDE</field><value name="A"><block type="math_single_basic" id="J}GFmoMcj2jrV1n}34r@"><field name="OP">ABS</field><value name="NUM"><block type="math_arithmetic" id="eAHQK#478Zr04L#%zXVX"><field name="OP">MINUS</field><value name="A"><block type="variables_get" id="lGKl.z?bO3QA`3?|Vxpf"><field name="VAR" id="LxkGe)=JaZ:.FWq%8/{%">Start-Tempo</field></block></value><value name="B"><block type="variables_get" id="E9SalBeRLNa6]tv)-12f"><field name="VAR" id="QmpV861a}-ED`kw_!OUj">End-Tempo</field></block></value></block></value></block></value><value name="B"><block type="variables_get" id="`kEE9ROpCT![N%}p6;u8"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></value><statement name="DO"><block type="motor_write_percentage" id="aO6!Re;~6y,48$4i`GJ^"><value name="MOTOR"><block type="motor_pin" id="8LgGxImN)|1r8a[IXGI1"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="#}=-G#;oVZ=.e61^9bt%"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="z5,:.g90Hf{sh(KZw$Km"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="HHDgjtii1nJ%W.JtfV25"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field></block></value></block></value><next><block type="motor_write_percentage" id="O=0KkQ]6fGYHQ)2@Pz}="><value name="MOTOR"><block type="motor_pin" id="~_}-G3=@D5^X:%RKG7u."><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_arithmetic" id="K2{7*QDhtAn{2}-WD/%d"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="@vp;6/WSb~=i^MhS=S-r"><field name="VAR" id="s4FBJ~ulwwAj1J|RD1|@">Tempo in %</field></block></value><value name="B"><block type="variables_get" id="I/JOS)4%CyQan/3:iUAf"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field></block></value></block></value><next><block type="flow_delay" id=";lzYQKjlTTZqDc/_4:^m"><value name="DELAY"><block type="math_number" id="z3s(n37Bs{Hy/5[9LV!A"><field name="NUM">1</field></block></value></block></next></block></next></block></statement></block></statement></block><block type="procedures_callnoreturn" id="$`347Mu.zr?u6er*B.J=" x="876" y="-379"><mutation name="drehe links"><arg name="Zeit in ms"></arg><arg name="Tempo in %"></arg></mutation><value name="ARG0"><block type="math_number" id="agn||YCF+(c,}`)g}_32"><field name="NUM">500</field></block></value><value name="ARG1"><block type="math_number" id="7vk+H8b.5JynBsa7/eiH"><field name="NUM">100</field></block></value></block><block type="procedures_defnoreturn" id="*2`6*YJKnt%=!hvULK)i" collapsed="true" x="101" y="-317"><mutation><arg name="Zeit in ms" varid="*:3e.esi^B`J%$5)X12H"></arg></mutation><field name="NAME">stoppe</field><statement name="STACK"><block type="motor_write_percentage" id="E|],,BqSrLd9@{yC;9Tl"><value name="MOTOR"><block type="motor_pin" id="WqAs2=rW5usmc%/1YGCP"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="#Uq}-VfY@VR(AgmJUbka"><field name="NUM">0</field></block></value><next><block type="motor_write_percentage" id="D5Vx`5TgSaKxMtd*=;c6"><value name="MOTOR"><block type="motor_pin" id="#q1Mj6*B0z4nQpm53QrG"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="9`Jq(CJP-z8v@RbaiLpX"><field name="NUM">0</field></block></value><next><block type="flow_delay" id="D;Oe@ky+Qf:ab7[b^qC%"><value name="DELAY"><block type="variables_get" id="*7c5;7=kM8(_T_.4J1Xz"><field name="VAR" id="*:3e.esi^B`J%$5)X12H">Zeit in ms</field></block></value></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="D?8m~{UZEw,gRWJ=lyrt" collapsed="true" x="101" y="-271"><field name="NAME">stoppe bis Sensor 1 oder 2 berührt werden</field><statement name="STACK"><block type="flow_until" id="LK(cABcMVespL,%xl[I;"><value name="CONDITION"><block type="logic_operation" id="V6,O|T(Mm+Pa=5|GSI;O"><field name="OP">OR</field><value name="A"><block type="sensor_test_state" id="k$)Xq$(Th.l(np;6l%(W"><field name="MODE">STANDARD</field><value name="SENSOR"><block type="sensor_pin" id="4:2cV=t#v|y*ns:57|pk"><field name="SENSOR">SENSOR1</field></block></value><value name="STATE"><block type="basic_digital_state" id="^Z!2?Q2fU{W#*2QjXb|B"><field name="STATE">LOW</field></block></value></block></value><value name="B"><block type="sensor_test_state" id="VN9EtrJK+|Y,~cl([_?A"><field name="MODE">STANDARD</field><value name="SENSOR"><block type="sensor_pin" id="90K_jtZ(.ed,2iG%|X~!"><field name="SENSOR">SENSOR2</field></block></value><value name="STATE"><block type="basic_digital_state" id="CoMqFe6[PDLh.Hh`Q{yH"><field name="STATE">LOW</field></block></value></block></value></block></value><statement name="DO"><block type="motor_write_percentage" id="8hy}9/~4vU]~)O%)iI44"><value name="MOTOR"><block type="motor_pin" id="fD%R*49Zq3eeRUj.dI4{"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="+DlNfo+sED)Zf]/dbhO)"><field name="NUM">0</field></block></value><next><block type="motor_write_percentage" id=":C:t@)w5[q.*7bQ^,D*{"><value name="MOTOR"><block type="motor_pin" id="N!dR[Rpyg}t8U18N9`b9"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="Mxo-NI/L`L|*K@L_MT3}"><field name="NUM">0</field></block></value></block></next></block></statement></block></statement></block><block type="procedures_defnoreturn" id="teqdL;Xne}3_$#5acQG1" collapsed="true" x="102" y="-224"><mutation><arg name="LED" varid="lO0ZYE*d3-TBXT4=/F%w"></arg><arg name="Intervall in ms" varid="0z{{*X:B1%h{p$#~9jog"></arg><arg name="Anzahl" varid="?~`j6li~gz]E9ASa.KQP"></arg></mutation><field name="NAME">blinke</field><statement name="STACK"><block type="flow_repeat" id="84;0;QCkVHG[hWb6S;jk"><value name="REPEATS"><block type="variables_get" id="[(%4+5h?#NVufzwMm=PU"><field name="VAR" id="?~`j6li~gz]E9ASa.KQP">Anzahl</field></block></value><statement name="DO"><block type="led_write_state" id="Q#r$V/4}goLh4JCARX2t"><value name="LED"><block type="variables_get" id="Ie(zgrcCcG@akugpkI0X"><field name="VAR" id="lO0ZYE*d3-TBXT4=/F%w">LED</field></block></value><value name="VALUE"><block type="basic_digital_state" id="9UbkEDc8XOV-=Gp:_sv2"><field name="STATE">LOW</field></block></value><next><block type="flow_delay" id="22HE}R^VvW-2eQDVm4rJ"><value name="DELAY"><block type="variables_get" id="UFVbmq{CWS_-A!Cl!*ir"><field name="VAR" id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</field></block></value><next><block type="led_write_state" id="sax*9,CvXy*]nL~T?12;"><value name="LED"><block type="variables_get" id="!qIT15TscM_85X+q#EeE"><field name="VAR" id="lO0ZYE*d3-TBXT4=/F%w">LED</field></block></value><value name="VALUE"><block type="basic_digital_state" id="uSl_cJOh~$TP,|tPH]ja"><field name="STATE">HIGH</field></block></value><next><block type="flow_delay" id=")~B2viE[QaJ,l`.SaQy:"><value name="DELAY"><block type="variables_get" id="DN~]AhE``r`IlVz/A=|}"><field name="VAR" id="0z{{*X:B1%h{p$#~9jog">Intervall in ms</field></block></value></block></next></block></next></block></next></block></statement></block></statement></block><block type="basic_comment" id=":f]r6`23+VV(tZ+IB$-w" x="881" y="-217"><field name="COMMENT">Funktionen für Erweiterungen:&amp;#10;&gt; lasse den Roboter beim Start langsam beschleunigen&amp;#10;&gt; lasse den Roboter langsam abbremsen, bevor er etwas neues macht&amp;#10;&gt; lasse den Roboter bei Programmstart erst losfahren, wenn du einen Sensor berührt hast</field></block><block type="procedures_defreturn" id="1{95fOK|YQj$):Ye?tzx" collapsed="true" x="103" y="-175"><field name="NAME">Gemessene Distanz in cm mit Ultraschallsensor an S3</field><statement name="STACK"><block type="led_write_state" id="D.Aw@M=~$.grAnuObBbh"><value name="LED"><block type="led_pin" id="/?Hx;.FZ0Z:~,P`Y_Iy+"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="EGCbx{pK#/c0)bpQ1S$:"><field name="STATE">LOW</field></block></value><next><block type="flow_delay_micro" id="~vi$Q8|t,ieh9x9{,-}j"><value name="DELAY_MICRO"><block type="math_number" id="0F!T(vR({+A.e4t)+)eq"><field name="NUM">5</field></block></value><next><block type="led_write_state" id="a~{7Z*qj}GBpctRT.n[Y"><value name="LED"><block type="led_pin" id="etDp;!3hx*ZAv(vgedP?"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="yCl~sepJMya+Vn})_+LN"><field name="STATE">HIGH</field></block></value><next><block type="flow_delay_micro" id="(7IH(q}Ufp3QMa]A#_hx"><value name="DELAY_MICRO"><block type="math_number" id="d~5}kTDbC:~nW9weO=[m"><field name="NUM">10</field></block></value><next><block type="led_write_state" id="4;ge?pcgEgn;zTr%4*|b"><value name="LED"><block type="led_pin" id="rr[C%~Z~,d}t(rKdpVNO"><field name="LED">LED3</field></block></value><value name="VALUE"><block type="basic_digital_state" id="E9vmv$q}|S@0eWRLa6v."><field name="STATE">LOW</field></block></value><next><block type="flow_while" id="J46#ClY#8iAC|d9sd[D7"><value name="CONDITION"><block type="logic_compare" id="2$H]yr/vzffF7_*NaCF`"><field name="OP">EQ</field><value name="A"><block type="sensor_read_state" id="QS.D0VHOBqgW?XtRvDhV"><value name="SENSOR"><block type="sensor_pin" id="FIKu6*CWMd%^n@%;^KPq"><field name="SENSOR">SENSOR3</field></block></value></block></value><value name="B"><block type="basic_digital_state" id="-|ZQEDJ,%tpzxHWoszw_"><field name="STATE">LOW</field></block></value></block></value><next><block type="variables_set" id="8H6mMsf:00(JgN8#9~kY"><field name="VAR" id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</field><value name="VALUE"><block type="flow_micro" id="uFTPzVQjA.:7?574Dz+S"></block></value><next><block type="flow_while" id="0+JWcX7${c/V1agz~{~~"><value name="CONDITION"><block type="logic_compare" id="O7#zdEPJy/Z$|BTFpZnu"><field name="OP">EQ</field><value name="A"><block type="sensor_read_state" id="p8::;:/2c9C72N:/Z+q("><value name="SENSOR"><block type="sensor_pin" id="w-[7Bh]ve|c1!{$T94/0"><field name="SENSOR">SENSOR3</field></block></value></block></value><value name="B"><block type="basic_digital_state" id="zKa(1}|0Z-piFkA$e)7X"><field name="STATE">HIGH</field></block></value></block></value><next><block type="variables_set" id=")+y.m%pPfDM$GPWR/5`}"><field name="VAR" id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</field><value name="VALUE"><block type="math_arithmetic" id="|ZG9t6SFEv9Hk^Bwwk6["><field name="OP">MINUS</field><value name="A"><block type="flow_micro" id="dP6IOW}qTd@+^-0}R1Ym"></block></value><value name="B"><block type="variables_get" id="xS2=qGUJ;~_DUY:{-P[G"><field name="VAR" id="Gt#^=(OVC9s1jWO6hUFu">Zeitstempel</field></block></value></block></value><next><block type="variables_set" id="tz1MO],0y*wAVS)|*)Y?"><field name="VAR" id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</field><value name="VALUE"><block type="math_arithmetic" id=")[DkL;,Uxl/SZD;Hn}7v"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="#uxi(=)]|Ai)(s:+aqA5"><field name="VAR" id=".gklvtf4@5gvI|=mU7D/">Verstrichene Zeit</field></block></value><value name="B"><block type="math_number" id="r?Kb;9IssvYq(JJ^Ilt="><field name="NUM">0.0175</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement><value name="RETURN"><block type="variables_get" id="3bEb2ZLsqp!xXU!g}7N/"><field name="VAR" id="|~,OsB~H~X)([2gt$CLf">Distanz in cm</field></block></value></block><block type="basic_comment" id="Z.T%z)$q/PQeHgiys?X/" x="106" y="-119"><field name="COMMENT">Dein Roboter fährt nicht schön geradeaus, weil ein Motor langsamer läuft?&amp;#10;******************************************************************************&amp;#10;Korrigiere die Motoren hier durch Verlangsamen eines Rades!&amp;#10;Reduziere dazu den Korrekturfaktor z.B. auf 0.95, um ein bestimmtes Rad zu verlangsamen&amp;#10;&amp;#10;M1 &lt; links rechts &gt; M2</field></block><block type="procedures_callnoreturn" id="cwSHM=}?FF#Qrtf{-f+g" x="883" y="-85"><mutation name="beschleunige gerade"><arg name="Start-Tempo"></arg><arg name="End-Tempo"></arg><arg name="Zeit in ms"></arg></mutation><value name="ARG0"><block type="math_number" id="?`+,n4.IVFCU[a0TegLc"><field name="NUM">0</field></block></value><value name="ARG1"><block type="math_number" id="!IwDVS~))1):!/RZRNl)"><field name="NUM">100</field></block></value><value name="ARG2"><block type="math_number" id="sZEb#Uz=1ybP3u}(NOaU"><field name="NUM">1000</field></block></value></block><block type="expert_setup" id="n`^X=a^-s/deQxv!gyOB" x="108" y="32"><statement name="CODE"><block type="variables_set" id="ogoAs~nAQ@y./_;{#*L`"><field name="VAR" id="5MT4jvb3P0}5#GS.D,87">Korrektur M1</field><value name="VALUE"><block type="math_number" id="Wu3sirdS,Cy+Hx]eyb_}"><field name="NUM">1</field></block></value><next><block type="variables_set" id="$}2$uF4PGhI~$^d,HXmq"><field name="VAR" id="HJYdxPCN]:ZCMUgos.h8">Korrektur M2</field><value name="VALUE"><block type="math_number" id="Dd7O+]Cw_+DO-K$Xp;W0"><field name="NUM">1</field></block></value></block></next></block></statement></block><block type="procedures_callnoreturn" id="LKPNUtr%-DAtt`wNPQHC" x="884" y="-8"><mutation name="stoppe"><arg name="Zeit in ms"></arg></mutation><value name="ARG0"><block type="math_number" id="aZe(riw:;_fF_!;@%6_y"><field name="NUM">1000</field></block></value></block><block type="procedures_callnoreturn" id="Bkg(,(KXsej.z,4~cNCK" x="885" y="67"><mutation name="stoppe bis Sensor 1 oder 2 berührt werden"></mutation></block></xml>
Lösung erweitert: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><block type="basic_comment" id="/11t(ikP@^J4;Y^tMv}(" x="1052" y="-164"><field name="COMMENT">FAHRROBOTER Challenge 1a "erweitert"&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, findest du sie im Menu</field></block><block type="basic_comment" id="Amw$%u:tCFOIg0gFR]I^" x="1051" y="-71"><field name="COMMENT">Erweiterungen:&amp;#10;&gt; Der Drehpunkt des Roboters befindet sich in der Mitte des Chassis. Ändere das Programm so, dass sich der Drehpunkt über&amp;#10;   dem inneren Rad der Drehung befindet.&amp;#10;&gt; Beschleunige einen Motor langsam mit einer zähle-von-bis Schleife: workshop.pglu.ch &gt; Sketch &gt; zähle-von-bis-alle&amp;#10;&gt; Vereinfache das Programm, indem du eigene Fahrfunktionen programmierst: workshop.pglu.ch &gt; Sketch &gt; Funktion</field></block><block type="basic_main_loop" id="8Np#B)0Vf^SF*=TW~5k/" deletable="false" x="1055" y="69"><value name="BLINK"><block type="basic_blinkcode" id="W.$!O{rF:YlxA}+Dr!t+"><field name="SHORT">1</field><field name="LONG">1</field></block></value><statement name="CODE"><block type="motor_write_percentage" id="$L=qJ~FODf%Y)3]^r;x@"><value name="MOTOR"><block type="motor_pin" id="XYNBU!.bOz)waUV*p?Du"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="r=B:4[jhJydGW*NXsgde"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id=".y+0|?Pp0HH6/!eKoZV_"><value name="MOTOR"><block type="motor_pin" id="3k|N4p^^OKP;*4l^O3to"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="qO2)R]O`!C9}va.%t?t5"><field name="NUM">100</field></block></value><next><block type="flow_delay" id=":xT7y6B;~{i,yF6DlCmZ"><value name="DELAY"><block type="math_number" id="`,h.zBj-s0##Q2@w+iJ3"><field name="NUM">1000</field></block></value><next><block type="motor_write_percentage" id="r!Hso-aO/~gDn}`[!UXF"><value name="MOTOR"><block type="motor_pin" id="X|oY5%9)wD5zCLI#xJ*d"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="4CZy!PAXl|q.D5rpumvU"><field name="NUM">-100</field></block></value><next><block type="motor_write_percentage" id="fkav%5a=Gqq}qA/A!o/)"><value name="MOTOR"><block type="motor_pin" id="$+*6~lkGoYs2%}Pk#3n="><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="A~r`n?}5h0gsi/6Cn]52"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="Gp`[6[`ubD5nkz;%-lGz"><value name="DELAY"><block type="math_number" id="E_jr?Y%6HPpxcsQmEsak"><field name="NUM">500</field></block></value><next><block type="motor_write_percentage" id="s3P|l;ihb|wKa6w8QNOR"><value name="MOTOR"><block type="motor_pin" id="d0oOvw)LaZGTkmK,.n9+"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="TTy`vvdd8X~A7F+7uzGA"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id="fjGBYAk=a29ZvrkjiF7B"><value name="MOTOR"><block type="motor_pin" id="^Qg}juT8S87B=+FXPa[z"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="|A1bM%{LWQF)tc^OV(Zt"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="oIq~)wXn9oxJOp-I}TQj"><value name="DELAY"><block type="math_number" id="wv58]bJ[QErs#@DZo~!}"><field name="NUM">1000</field></block></value><next><block type="motor_write_percentage" id="Ob}K7!`c%Fc.Jk7LBs9;"><value name="MOTOR"><block type="motor_pin" id="B8IA[?-)T~]UiFbxMXq@"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="-cTZI=(mJ;z-=5p{S*Ph"><field name="NUM">-100</field></block></value><next><block type="motor_write_percentage" id="k!auekC-zWsNAH1Tj73r"><value name="MOTOR"><block type="motor_pin" id="fWOXOhlQd@Tre}PXd~|y"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="D~iJq^w58-sMtg9?hb40"><field name="NUM">100</field></block></value><next><block type="flow_delay" id=":DuolR;|s7vh:O2o,Y/#"><value name="DELAY"><block type="math_number" id="LY`![qlpUki]Xqbf(ii:"><field name="NUM">500</field></block></value><next><block type="motor_write_percentage" id="e8u,E,qUoPucjOZ]Fnj~"><value name="MOTOR"><block type="motor_pin" id="0k%~~g+DeS1A7Knpm5{a"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="BJB(NoMjt?28l%p($cc*"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id="NY:k:`45Tz8i$+ronnxt"><value name="MOTOR"><block type="motor_pin" id="eJ^Q-JqBTrBV|MYI~x:x"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="4--]RitXn7ZYV2N7V]iv"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="d/y[E}Gs?E5KZme4gp8C"><value name="DELAY"><block type="math_number" id="+D;C_:/bF5PJ$P8mx/.4"><field name="NUM">1000</field></block></value><next><block type="motor_write_percentage" id=")FUbGr~6jD[LT6E@v[J~"><value name="MOTOR"><block type="motor_pin" id="+SrE(,)2wT`3hNpxH`^~"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="G$Eil)~zZUaB]@-{{ctn"><field name="NUM">-100</field></block></value><next><block type="motor_write_percentage" id="MV.DiM!)8SIhsMe*~4(5"><value name="MOTOR"><block type="motor_pin" id="]@h)|?GIhI:T;qTyPnd!"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="!ENoX7,xshuZXDf$Ey.H"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="jm_=@(/.7qx#_sTA{vY^"><value name="DELAY"><block type="math_number" id="$lyU_%[a?3qX^P|js(pp"><field name="NUM">500</field></block></value><next><block type="motor_write_percentage" id="NU4|OFHIr1%pc?:),W$q"><value name="MOTOR"><block type="motor_pin" id=",@DOPS[?7)CRxAP82og?"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="n-NL:F9cou~C?cc,BcQs"><field name="NUM">100</field></block></value><next><block type="motor_write_percentage" id="398;zWP2@[%t9N9o{TF)"><value name="MOTOR"><block type="motor_pin" id="m%[w^AsmKvq0j6u~4VIo"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="l;F-0i`I:q3f?A1kJKsP"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="OD;,D1x[aa[`pCx9lrQK"><value name="DELAY"><block type="math_number" id="F2W-4c]l7Bzq/9m_pl@x"><field name="NUM">1000</field></block></value><next><block type="motor_write_percentage" id="UM:MOC4vq2}=hExlDh6l"><value name="MOTOR"><block type="motor_pin" id=";bSj+Vp`LAShffrQyDBt"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="math_number" id="IE%4nG+z-?kQG(8aSW:n"><field name="NUM">-100</field></block></value><next><block type="motor_write_percentage" id="[x*:V/eU%x)0--2@D#^K"><value name="MOTOR"><block type="motor_pin" id=".q{RC;hp%C}`SuqC/RCx"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="B_$Q_l+(ZRkqLpOS;K8~"><field name="NUM">100</field></block></value><next><block type="flow_delay" id="bQDYBphSzy}LL:pDg/O2"><value name="DELAY"><block type="math_number" id="DW8uY$1hO:T(+$.X9d*j"><field name="NUM">500</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="basic_comment" id="/wmu/CoXGZ:eMSrwXH,X" x="920" y="103"><field name="COMMENT">fahre geradeaus</field></block><block type="basic_comment" id="0x[yuU,z17N,Le]$c;I:" x="946" y="226"><field name="COMMENT">drehe links</field></block><block type="basic_comment" id="QNC3vO2wyNWt/v@1%oEN" x="921" y="347"><field name="COMMENT">fahre geradeaus</field></block><block type="basic_comment" id="HBn3rav!jajlSNgFXLVd" x="942" y="469"><field name="COMMENT">drehe links</field></block><block type="basic_comment" id=";P)C7;8AVA47_|nAVpFi" x="920" y="594"><field name="COMMENT">fahre geradeaus</field></block><block type="basic_comment" id="I)U}+r8zu4L;?hE?K*!6" x="949" y="718"><field name="COMMENT">drehe links</field></block><block type="basic_comment" id="WE}T=*LN2@y9@sIO$OL}" x="918" y="844"><field name="COMMENT">fahre geradeaus</field></block><block type="basic_comment" id="Hw:|labevmxk.uThYQNJ" x="944" y="970"><field name="COMMENT">drehe links</field></block></xml>
1b

Einen Kreis oder eine Spirale fahren

Wie geht das?

Das Fahren eines Kreises ist sehr simpel, denn dafür muss eines der beiden Räder langsamer laufen als das andere.

Wie aber kann der Roboter eine Spirale fahren? Wie beim Kreis muss eines der Räder langsamer drehen als das andere. Mit einer zähle-von-bis Schleife kannst du die Geschwindigkeit dieses Rades aber langsam erhöhen, sodass der Kreisradius immer grösser wird.

Roboter fährt einen Kreis

Was ist eine zähle-von-bis Schleife? Lerne hier mehr darüber: workshop.pglu.ch > Sketch > zähle-von-bis-alle

Challenge:

Challenge: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</variable></variables><block type="basic_comment" id="/11t(ikP@^J4;Y^tMv}(" x="1052" y="-164"><field name="COMMENT">FAHRROBOTER Challenge 1b fahre eine Spirale&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, findest du sie im Menu</field></block><block type="basic_comment" id="Amw$%u:tCFOIg0gFR]I^" x="1051" y="-71"><field name="COMMENT">Erweiterungen:&amp;#10;&gt; Fahre die Spirale nur solange, bis der Roboter gegen eine Hindenis stösst.&amp;#10;   Wenn du den Lehrgang pglu.ch &gt; CODING &gt; ARDUINO ROBOTER &gt; AUFGABE 1-6&amp;#10;   gemacht hast, solltest du diese Challenge auch mit einem Sensor meistern können</field></block><block type="flow_for" id="NY2Pq?Y@f4LHfe*Zp|bT" x="509" y="76"><field name="VAR" id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</field><value name="FROM"><block type="math_number" id=";6OYR]|G2XN`VHt2AYJX"><field name="NUM">30</field></block></value><value name="TO"><block type="math_number" id="!M}DAT3/S[j7`?l*Lo35"><field name="NUM">100</field></block></value><value name="BY"><block type="math_number" id="qr3k=@t4tedNP_7lboTo"><field name="NUM">1</field></block></value></block><block type="basic_main_loop" id="8Np#B)0Vf^SF*=TW~5k/" deletable="false" x="1055" y="69"><value name="BLINK"><block type="basic_blinkcode" id="W.$!O{rF:YlxA}+Dr!t+"><field name="SHORT">1</field><field name="LONG">1</field></block></value></block><block type="motor_write_percentage" id="$L=qJ~FODf%Y)3]^r;x@" x="510" y="197"><value name="MOTOR"><block type="motor_pin" id="XYNBU!.bOz)waUV*p?Du"><field name="MOTOR">MOTOR1</field></block></value><next><block type="motor_write_percentage" id=".y+0|?Pp0HH6/!eKoZV_"><value name="MOTOR"><block type="motor_pin" id="3k|N4p^^OKP;*4l^O3to"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="qO2)R]O`!C9}va.%t?t5"><field name="NUM">100</field></block></value></block></next></block><block type="basic_comment" id="0Y[6O-]VS0Re5#h7ai;." x="3" y="332"><field name="COMMENT">Diese Pause ist dazu da, die Beschleunigung des Rades langsamer zu machen.</field></block><block type="flow_delay" id=":xT7y6B;~{i,yF6DlCmZ" x="515" y="324"><value name="DELAY"><block type="math_number" id="`,h.zBj-s0##Q2@w+iJ3"><field name="NUM">800</field></block></value></block><block type="basic_comment" id="-XG|=OkAnu(-W~I=u;[%" x="21" y="412"><field name="COMMENT">Dies ist eine Variable. Sie steht für die aktuelle Geschwindigkeit des Rades.</field></block><block type="variables_get" id=".;j9ze:e{QDUSgyJk/E`" x="508" y="410"><field name="VAR" id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</field></block></xml>

Mögliche Lösung:

Lösung: XML-Code in Editor einfügen
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</variable></variables><block type="basic_comment" id="/11t(ikP@^J4;Y^tMv}(" x="1052" y="-164"><field name="COMMENT">FAHRROBOTER Challenge 1b fahre eine Spirale&amp;#10;&amp;#10;Setze die Blöcke in den Hauptloop ein. Wenn du mehr Blöcke brauchst, findest du sie im Menu</field></block><block type="basic_comment" id="Amw$%u:tCFOIg0gFR]I^" x="1051" y="-71"><field name="COMMENT">Erweiterungen:&amp;#10;&gt; Fahre die Spirale nur solange, bis der Roboter gegen eine Hindenis stösst.&amp;#10;   Wenn du den Lehrgang pglu.ch &gt; CODING &gt; ARDUINO ROBOTER &gt; AUFGABE 1-6&amp;#10;   gemacht hast, solltest du diese Challenge auch mit einem Sensor meistern können</field></block><block type="basic_main_loop" id="8Np#B)0Vf^SF*=TW~5k/" deletable="false" x="1055" y="69"><value name="BLINK"><block type="basic_blinkcode" id="W.$!O{rF:YlxA}+Dr!t+"><field name="SHORT">1</field><field name="LONG">1</field></block></value><statement name="CODE"><block type="motor_write_percentage" id=".y+0|?Pp0HH6/!eKoZV_"><value name="MOTOR"><block type="motor_pin" id="3k|N4p^^OKP;*4l^O3to"><field name="MOTOR">MOTOR2</field></block></value><value name="PERCENTAGE"><block type="math_number" id="qO2)R]O`!C9}va.%t?t5"><field name="NUM">100</field></block></value><next><block type="flow_for" id="NY2Pq?Y@f4LHfe*Zp|bT"><field name="VAR" id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</field><value name="FROM"><block type="math_number" id=";6OYR]|G2XN`VHt2AYJX"><field name="NUM">30</field></block></value><value name="TO"><block type="math_number" id="!M}DAT3/S[j7`?l*Lo35"><field name="NUM">100</field></block></value><value name="BY"><block type="math_number" id="qr3k=@t4tedNP_7lboTo"><field name="NUM">1</field></block></value><statement name="DO"><block type="motor_write_percentage" id="$L=qJ~FODf%Y)3]^r;x@"><value name="MOTOR"><block type="motor_pin" id="XYNBU!.bOz)waUV*p?Du"><field name="MOTOR">MOTOR1</field></block></value><value name="PERCENTAGE"><block type="variables_get" id=".;j9ze:e{QDUSgyJk/E`"><field name="VAR" id="e5X.ECwIulvrLP9O0]*?">Geschwindigkeit Rad</field></block></value><next><block type="flow_delay" id=":xT7y6B;~{i,yF6DlCmZ"><value name="DELAY"><block type="math_number" id="`,h.zBj-s0##Q2@w+iJ3"><field name="NUM">800</field></block></value></block></next></block></statement></block></next></block></statement></block><block type="basic_comment" id="/wmu/CoXGZ:eMSrwXH,X" x="771" y="103"><field name="COMMENT">erhöhe die Zahl "Geschwindigkeit Rad"&amp;#10;alle 10 ms um 1 Prozent&amp;#10;&amp;#10;Wie lange dauert es, bis das Rad an M1&amp;#10;mit 100% dreht?</field></block></xml>

Anforderung:
✓ Einfach
✓ Bauen ohne Werkstatt
✓ Mehrmals bauen und zerlegen

Thema:
> Controller steuert Motor
> Einfacher Programmablauf
> Einfache Variable (1b)
> Zähle-von-bis (1b)

Werkzeug:
> Lötstation

Material:
> Bausatz pglu.ch/shop > Arduino Roboter
> pglu.ch/shop > Mikrocontroller KOMFORT oder MOTOR

Anleitung:
> Roboter bauen: TTG PROJEKT > ARDUINO ROBOTER > BAU
> Elektronik anschliessen: TTG PROJEKT > ARDUINO ROBOTER > BAU
> Roboter programmieren: TTG PROJEKT> ARDUINO ROBOTER > CODING

3D-Modell:
> Hier anschauen

Videos:
> Rückwärts einparkieren: TTG PROJEKT > ARDUINO ROBOTER > CODING > VIDEOS

Basics:
> Lernumgebung aufbauen: pglu.ch > ANLEITUNG
> XML in Editor importieren: pglu.ch > ANLEITUNG > EDITOR

Editor:
> Online: mach.pglu.ch
> Teacher’s Box: mach.pglu.box

Erweiterungen:
> Ultraschallsensor: workshop.pglu.ch > SENSOR
> Weiteres: pglu.ch > HILFREICHE DOKUMENTE
> Erweiterung mit KI: ki-kit.ch