Peng Hong Liem
Published © GPL3+

M5Stack Based PID Control Learning Platform

The PID Control Learning Platform is based on an M5Stack Fire & BaseX with TOF and Accel Units, and some Lego NXT parts.

AdvancedWork in progressOver 2 days3,078
M5Stack Based PID Control Learning Platform

Things used in this project

Story

Read more

Schematics

PID_platform

The appearance of the code under M5Stack UIFlow IDE.

Code

PID Platform

Plain text
Use UIFlow to open and run the code (m5f format)
{"components":[{"id":"____screen","createTime":1600517882043,"name":"screen","x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","backgroundImage":"","type":"screen"},{"id":"____buttonA","createTime":1600517882043,"name":"ButtonA","buttonIndex":0,"x":35,"y":216,"width":64,"height":24,"text":"ButtonA","visibility":false,"type":"button"},{"id":"____buttonB","createTime":1600517882043,"name":"ButtonB","buttonIndex":1,"x":125,"y":216,"width":64,"height":24,"text":"ButtonB","visibility":false,"type":"button"},{"id":"____buttonC","createTime":1600517882043,"name":"ButtonC","buttonIndex":2,"x":215,"y":216,"width":64,"height":24,"text":"ButtonC","visibility":false,"type":"button"},{"id":"+o1C&3z6&Kw4Tn4f","createTime":1600517949223,"name":"title0","x":0,"y":0,"width":320,"height":20,"color":"#FFFFFF","backgroundColor":"#0000FF","text":"PID Learning Platform","textOffset":"80","font":"lcd.FONT_Default","type":"title","layer":4},{"id":"Z@6$80J6LA*Jo_Xj","createTime":1600518003730,"isCoreTwo":false,"name":"label0","x":10,"y":30,"color":"#FFFFFF","text":"TOF","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":5},{"id":"tNO1v6%zjckS5cQ2","createTime":1600518031947,"isCoreTwo":false,"name":"label1","x":140,"y":30,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":6},{"id":"AL9h@jiOgy@B&M1i","createTime":1600518047475,"isCoreTwo":false,"name":"label2","x":10,"y":60,"color":"#FFFFFF","text":"Y-Accel","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":7},{"id":"oSkzh&ZVj3FLmNws","createTime":1600518068827,"isCoreTwo":false,"name":"label3","x":140,"y":60,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":8},{"id":"Os6@1EeJ`T+LeEd&","createTime":1600519331563,"isCoreTwo":false,"name":"label4","x":78,"y":212,"color":"#05f920","text":"Ready","font":"lcd.FONT_DejaVu18","rotation":0,"type":"label","layer":9},{"id":"*WaRSS`y%9$8Ffmq","createTime":1600520925558,"isCoreTwo":false,"name":"label5","x":10,"y":90,"color":"#FFFFFF","text":"M1-Enc","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":10},{"id":"po*OsF%CgO*V-o3o","createTime":1600520985623,"isCoreTwo":false,"name":"label6","x":140,"y":90,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":11},{"id":"1b*5CTH7kjMgvS3t","createTime":1600524361577,"isCoreTwo":false,"name":"label7","x":10,"y":120,"color":"#FFFFFF","text":"M3-Enc","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":12},{"id":"I#WZ!lh_znyEfHGi","createTime":1600524406068,"isCoreTwo":false,"name":"label8","x":140,"y":120,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":13},{"id":"9tslb!UfdTNOnqzb","createTime":1600561954502,"isCoreTwo":false,"name":"label9","x":10,"y":150,"color":"#FFFFFF","text":"TOF-Err","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":26},{"id":"yEgPd5qHl!OmzIcj","createTime":1600561982567,"isCoreTwo":false,"name":"label10","x":140,"y":150,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":27},{"id":"o0ShEpR@ATu*63OI","createTime":1600573148319,"isCoreTwo":false,"name":"label11","x":10,"y":180,"color":"#FFFFFF","text":"Drive","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":16,"width":null,"height":null,"radius":null},{"id":"z_qthQRtUQ&zbC9X","createTime":1600573189178,"isCoreTwo":false,"name":"label12","x":140,"y":180,"color":"#FFFFFF","text":"0","font":"lcd.FONT_DejaVu24","rotation":0,"type":"label","layer":17,"width":null,"height":null,"radius":null}],"type":"core","versions":"Stabile","units":[{"id":"iZV1%fQy+$zpKtYd","createTime":1600571028828,"stickNone":"stick","type":"tof","name":"tof0","port":"A","default":["A","E","PAHUB","Custom"],"pb_port":[0,1,2,3,4,5],"new_pb_port":"0","icon":"tof.png"},{"id":"4J@&j65Poy5xK5i0","createTime":1600571028829,"type":"accel","name":"accel0","port":"A","default":["A","E","PAHUB","Custom"],"pb_port":[0,1,2,3,4,5],"new_pb_port":"0","icon":"accel.png"}],"hats":[],"blockly":"<variables><variable id=\"30.|zhA*dUz/sta6n@J-\">mode</variable><variable id=\".R|t3)KP2m?WW$s}[XU*\">distance0</variable><variable id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</variable><variable id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</variable><variable id=\"2M-p^/y[plN@1k)}C:cw\">Kp</variable><variable id=\"qHo*A^zPb+aF|w88G`?R\">Error</variable><variable id=\"Ms+YNJB|}dG+#VRk,/a/\">distance</variable><variable id=\"pyojY%@E,4r~)QUO851N\">angle</variable><variable id=\"W|/hEM,uSN%!e0pOR(T#\">motor</variable><variable id=\"g+DuTB7i})1u;}Ua+qt[\">joy</variable><variable id=\"7by[9-bdbKdlm.U3=d:7\">drive</variable></variables><block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"97\" y=\"96\"><next><block type=\"variables_set\" id=\"N-ys_qf{DqRKDguUFa.t\"><field name=\"VAR\" id=\"30.|zhA*dUz/sta6n@J-\">mode</field><value name=\"VALUE\"><block type=\"math_number\" id=\"mXxEZoW-?_)*npY@DH3t\"><field name=\"NUM\">0</field></block></value><next><block type=\"basex_set_mode\" id=\"[:BGJW2n_BZkA/S~#u?H\"><field name=\"POS\">1</field><field name=\"MODE\">base_x.POSITION_MODE</field><next><block type=\"basex_set_mode\" id=\"wBZ|}dr0[Y6ywbYyCgR*\"><field name=\"POS\">3</field><field name=\"MODE\">base_x.NORMAL_MODE</field><next><block type=\"variables_set\" id=\"Hz6JcR0a.f@_Bt}u{JjT\"><field name=\"VAR\" id=\"2M-p^/y[plN@1k)}C:cw\">Kp</field><value name=\"VALUE\"><block type=\"math_number\" id=\"4m3]oR^SOu(xi@7#nlc6\"><field name=\"NUM\">3</field></block></value><next><block type=\"variables_set\" id=\"L]^GgmKD)KBsI;!dVJEO\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field><value name=\"VALUE\"><block type=\"math_number\" id=\"}+-k9`JncN4LuuDQC/bX\"><field name=\"NUM\">0</field></block></value><next><block type=\"procedures_callnoreturn\" id=\"!Qds;%#!68SaV_n?C$pt\"><mutation name=\"calibrate\"></mutation><next><block type=\"basic_on_loop\" id=\"Yrv2m?g,;4fjXbF+4xW]\"><statement name=\"LOOP\"><block type=\"controls_ifelse\" id=\"ts,2W-N[9F6SH2Cc2+V5\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"Jv[+m_]InI`)qk~%5cLo\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"variables_get\" id=\"X,w?#z!,TwH7d|KEfjY-\"><field name=\"VAR\" id=\"30.|zhA*dUz/sta6n@J-\">mode</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"lTQ9cFAdG.RKF-eN9e4+\"><field name=\"NUM\">0</field></block></value></block></value><statement name=\"DO0\"><block type=\"label_set_text\" id=\"3BpQpRDL(-8,izZbgE9q\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"G.us*-.=4L~GM]!YVa;C\"><field name=\"TEXT\">Manual</field></shadow></value></block></statement><statement name=\"ELSE\"><block type=\"label_set_text\" id=\"4dgf%;z;K.RYcH-lxN#y\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"y_%kCMUcR+%;u`5-B[)J\"><field name=\"TEXT\">     PID</field></shadow></value></block></statement><next><block type=\"variables_set\" id=\"R@hUYULL3!oI=y+I3+yM\"><field name=\"VAR\" id=\"Ms+YNJB|}dG+#VRk,/a/\">distance</field><value name=\"VALUE\"><block type=\"unit_tof_state\" id=\"o|+YQ)$H:`4uq+gnt5PW\"><field name=\"TOF\">tof0</field></block></value><next><block type=\"variables_set\" id=\"HgY|o+s~W}:iKjxkcr^}\"><field name=\"VAR\" id=\"pyojY%@E,4r~)QUO851N\">angle</field><value name=\"VALUE\"><block type=\"unit_accel_get_y_acc\" id=\"2ROz1hd.k8nk(MpZqo3P\"><field name=\"POS\">accel0</field></block></value><next><block type=\"variables_set\" id=\"l`TK1TcM8FeBB/nb4V@;\"><field name=\"VAR\" id=\"W|/hEM,uSN%!e0pOR(T#\">motor</field><value name=\"VALUE\"><block type=\"basex_get_encoder\" id=\"o^pppHdyIo7!{Jt[qvd(\"><field name=\"POS\">1</field></block></value><next><block type=\"variables_set\" id=\"{lGwN_b%2B@]dJ3SfJE]\"><field name=\"VAR\" id=\"g+DuTB7i})1u;}Ua+qt[\">joy</field><value name=\"VALUE\"><block type=\"basex_get_encoder\" id=\".-c#@ILWItdMGJ_ciIzg\"><field name=\"POS\">3</field></block></value><next><block type=\"variables_set\" id=\"x`/0(N1|ALEy``Pb#~}$\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"$/XOiAt6FI@3(bH=KNZN\"><field name=\"OP\">MINUS</field><value name=\"A\"><block type=\"variables_get\" id=\"^k@Ht##p83ma-Ic_vTlI\"><field name=\"VAR\" id=\"Ms+YNJB|}dG+#VRk,/a/\">distance</field></block></value><value name=\"B\"><block type=\"variables_get\" id=\"dGST4eoG5m[P;n1^FGc}\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field></block></value></block></value><next><block type=\"variables_set\" id=\"x`0}$Z!vGuTmQp(]y)_)\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"_Z7VMQ_,=p3k`vF#T1qC\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"variables_get\" id=\"0zrJj_*[2XDT6rbTbBe0\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"26YpHB/s%+7.zpSU=4q8\"><field name=\"NUM\">100</field></block></value></block></value><next><block type=\"label_set_text\" id=\"tgaYqy{Il_)|;v:5DIo:\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"L^kR4HyBEtC7{Is*C|n~\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"+srga}7+z?R$~gD#g(;7\"><field name=\"VAR\" id=\"Ms+YNJB|}dG+#VRk,/a/\">distance</field></block></value><next><block type=\"label_set_text\" id=\"0[!b1pR.xL~-;NYat=,P\"><field name=\"COMPONENT\">label3</field><value name=\"TEXT\"><shadow type=\"text\" id=\"Xu;JU6`Yb$8*+y`V(E^=\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"7t#|z(.%T1e`vFVEH4E#\"><field name=\"VAR\" id=\"pyojY%@E,4r~)QUO851N\">angle</field></block></value><next><block type=\"label_set_text\" id=\"zjJQSKnAw`d)!)./;,mj\"><field name=\"COMPONENT\">label6</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"MjulTTY~|Tf5.y9Iq-Qs\"><field name=\"VAR\" id=\"W|/hEM,uSN%!e0pOR(T#\">motor</field></block></value><next><block type=\"label_set_text\" id=\"hNR{DSKfaFU)RGC0W..A\"><field name=\"COMPONENT\">label8</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"pG!iNNa;icC~|KTQs2/T\"><field name=\"VAR\" id=\"g+DuTB7i})1u;}Ua+qt[\">joy</field></block></value><next><block type=\"label_set_text\" id=\"M*BkHo13!Z!l:EnvOpgc\"><field name=\"COMPONENT\">label10</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"?{u[?:-A?}n{X)3oA!$@\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field></block></value><next><block type=\"controls_ifelse\" id=\"=uQ2iK;4+=LSl))SOz;3\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"3b*^RClF-d%]fqc.F*^~\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"variables_get\" id=\"7Ig^@bJ7Hds-sC?7nOEZ\"><field name=\"VAR\" id=\"30.|zhA*dUz/sta6n@J-\">mode</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"|FRr^KmF{%,lK-QG(DZJ\"><field name=\"NUM\">0</field></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"[BhDA;hK~pfY,!gdA3dI\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field><value name=\"VALUE\"><block type=\"variables_get\" id=\"caY(+bUzD=J$1g!scU;=\"><field name=\"VAR\" id=\"g+DuTB7i})1u;}Ua+qt[\">joy</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"variables_set\" id=\"lvzB*pjXYL~~QB8Ap(_%\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field><value name=\"VALUE\"><block type=\"convent_int\" id=\"WESKm%CPM!hm/~1QTBn9\"><value name=\"VALUE\"><block type=\"math_arithmetic_arr\" id=\"0vTTS%t#?xy)pnweQPMp\"><field name=\"OP\">MULTIPLY</field><value name=\"A\"><block type=\"variables_get\" id=\"tFtr!aQTcu4!hbz7;goZ\"><field name=\"VAR\" id=\"qHo*A^zPb+aF|w88G`?R\">Error</field></block></value><value name=\"B\"><block type=\"variables_get\" id=\"n9?[B_]8:Vd;Kt~oV/U@\"><field name=\"VAR\" id=\"2M-p^/y[plN@1k)}C:cw\">Kp</field></block></value></block></value></block></value></block></statement><next><block type=\"controls_if\" id=\"awu$(gQ7O,jFEmUEk7*j\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"bbue]QdFeg:6AN_Sln8V\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"variables_get\" id=\";`lv(P_~K}M.DuJ5QzrY\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"-~I[gHHxY@nS{EY_Wb*-\"><field name=\"NUM\">12</field></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"?N)o+w%a@#H4yXS#afjK\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field><value name=\"VALUE\"><block type=\"math_number\" id=\"MNPj!A]]T)rltjUt,GY]\"><field name=\"NUM\">12</field></block></value></block></statement><next><block type=\"controls_if\" id=\"J;D8i6A$*^D$3iE?t-J#\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"Z_ik),v!mUoBL,)[+%J_\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"variables_get\" id=\"bpWq^{in4sCx|+b:wfIT\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"N#X^F2CAr5vjvpQSmolQ\"><field name=\"NUM\">-15</field></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"~Azw/)Zc^D=jEeRuK0(P\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field><value name=\"VALUE\"><block type=\"math_number\" id=\"kanE:e~F?zwbGBf9xu[=\"><field name=\"NUM\">-15</field></block></value></block></statement><next><block type=\"label_set_text\" id=\"a^]p#:/O{p/R%]]jCu(}\"><field name=\"COMPONENT\">label12</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"H-x@Arl25Oo8#Wu^=iC]\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</field></block></value><next><block type=\"basex_set_position_point\" id=\"[Rc=_^;6^g(-AM,q_~^C\"><field name=\"POS\">1</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"we~iK?`!g1Flv6(Nv^:M\"><field name=\"NUM\">0</field></shadow><block type=\"variables_get\" id=\"04vMd+Kus~ph$=lc?=3E\"><field name=\"VAR\" id=\"7by[9-bdbKdlm.U3=d:7\">drive</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></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block><block type=\"procedures_defnoreturn\" id=\"{X5ttx,Rlr_[0oH8*4!n\" collapsed=\"true\" x=\"810\" y=\"130\"><field name=\"NAME\">calibrate</field><statement name=\"STACK\"><block type=\"basex_set_encoder\" id=\"4aj`bs4@YY%t2ih3c_@g\"><field name=\"POS\">1</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"lW[GT^:__z`_qD3:Lg`g\"><field name=\"NUM\">0</field></shadow></value><next><block type=\"basex_set_encoder\" id=\"M$yY*U4=znqJb~b,qMh`\"><field name=\"POS\">3</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"Vs{Ip)%P=|zG-.uC6{)A\"><field name=\"NUM\">0</field></shadow></value><next><block type=\"label_set_text\" id=\"46lM|B?H-LwUcvhGgg6t\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"i:7Bc1;)J#,~`@LKj%.O\"><field name=\"TEXT\">TOF Calibration</field></shadow></value><next><block type=\"procedures_callnoreturn\" id=\"vfR?@YmknxChPAJXrl]|\"><mutation name=\"calibrate_distance\"></mutation><next><block type=\"label_set_text\" id=\"6RJ1{VIo7A~B_~=%O/1s\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"[3.exw5G%P8}BTR2OcGw\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field></block></value><next><block type=\"label_set_text\" id=\"4jtp{Kqy~2N-`gm.GvQ,\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"CsBHon1a6NS8~`}QL!%x\"><field name=\"TEXT\">Accel Calibration</field></shadow></value><next><block type=\"procedures_callnoreturn\" id=\"[37{BaZEas+?iDjlw=V;\"><mutation name=\"calibrate_accel\"></mutation><next><block type=\"label_set_text\" id=\";?]Sn`m!!QE2STUFfY[h\"><field name=\"COMPONENT\">label3</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"Ye?il2JjM}k%}:epb%@-\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field></block></value><next><block type=\"label_set_text\" id=\"/yR!K%E!~eC-l?3]{L4V\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"Y-r!ncqB!%a]xZMeF4hO\"><field name=\"TEXT\">Motor Calibration</field></shadow></value><next><block type=\"procedures_callnoreturn\" id=\"C4~E`upRWad[WU2$/cs!\"><mutation name=\"calibrate_motor\"></mutation><next><block type=\"label_set_text\" id=\"dbmj9GCfBK.x%/KR(Do2\"><field name=\"COMPONENT\">label6</field><value name=\"TEXT\"><shadow type=\"text\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"variables_get\" id=\"_jub)YmbIf42Q?3PTErg\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field></block></value><next><block type=\"label_set_text\" id=\"Ac$%XbSh6_],hwww%(Y,\"><field name=\"COMPONENT\">label4</field><value name=\"TEXT\"><shadow type=\"text\" id=\"DSIVv=Pbss,@[e[$%p-]\"><field name=\"TEXT\">Ready</field></shadow></value></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=\"procedures_defnoreturn\" id=\"hT4jI,Dr?EqkUe~=QXI0\" collapsed=\"true\" x=\"810\" y=\"170\"><field name=\"NAME\">calibrate_distance</field><statement name=\"STACK\"><block type=\"variables_set\" id=\"3Mv7RxLqQ)pB/h0wQqm^\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field><value name=\"VALUE\"><block type=\"unit_tof_state\" id=\"5GuS7R$BmrasScjLXKL%\"><field name=\"TOF\">tof0</field></block></value><next><block type=\"controls_repeat\" id=\",=L;0s[HIv_W${phJaS.\"><field name=\"TIMES\">9</field><statement name=\"DO\"><block type=\"variables_set\" id=\"zV^QUCPb1kiVFg$B#bNq\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"bXIK{OW+C*=C,Br++vx8\"><field name=\"OP\">ADD</field><value name=\"A\"><block type=\"variables_get\" id=\"*$Vte}(vw35gyzb,dre@\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field></block></value><value name=\"B\"><block type=\"unit_tof_state\" id=\"*V:y)q95b80UQ/*}Io2x\"><field name=\"TOF\">tof0</field></block></value></block></value><next><block type=\"timer_delay_ms\" id=\"y;0.VF3xeaK0luU2+qgE\"><value name=\"DELAY\"><shadow type=\"math_number\" id=\"*8hjm6Ru3U!x_747VRD3\"><field name=\"NUM\">100</field></shadow></value></block></next></block></statement><next><block type=\"variables_set\" id=\"tma2u/cJ$E6qkL?V28uX\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"-LSC?9#}yF4/KkUiizVb\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"variables_get\" id=\":s=Cpp:cA?QzW`xBmMvE\"><field name=\"VAR\" id=\".R|t3)KP2m?WW$s}[XU*\">distance0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"?NLpvR,qQKpRVuqyA|7e\"><field name=\"NUM\">10</field></block></value></block></value></block></next></block></next></block></statement></block><block type=\"procedures_defnoreturn\" id=\"j6Nyi4^v0{svkjArb/O*\" collapsed=\"true\" x=\"810\" y=\"210\"><field name=\"NAME\">calibrate_accel</field><statement name=\"STACK\"><block type=\"variables_set\" id=\"$:}+jDbeFW*.Pbj5t*vu\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field><value name=\"VALUE\"><block type=\"unit_accel_get_y_acc\" id=\"Q6iO=E_NB6W_6/^sUj(+\"><field name=\"POS\">accel0</field></block></value><next><block type=\"controls_repeat\" id=\"8kY0UH*3$6cvas7GkM`o\"><field name=\"TIMES\">9</field><statement name=\"DO\"><block type=\"variables_set\" id=\"?(C@w./i^b4Xl~;|]lH|\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"P@UhTVbe5$WxD*887EjT\"><field name=\"OP\">ADD</field><value name=\"A\"><block type=\"variables_get\" id=\"h1K0%hT])`{vFSwi@40A\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field></block></value><value name=\"B\"><block type=\"unit_accel_get_y_acc\" id=\"WSbB]p^;xw[P=qkLc_GO\"><field name=\"POS\">accel0</field></block></value></block></value><next><block type=\"timer_delay_ms\" id=\"OYVbedr/+KJM*q+-bwx+\"><value name=\"DELAY\"><shadow type=\"math_number\" id=\"cMuS4U-#i`bwgF-Hj,x]\"><field name=\"NUM\">100</field></shadow></value></block></next></block></statement><next><block type=\"variables_set\" id=\"MA1o+].L3n}wkK+zp!]k\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"A;?4%PI~$/cj[_+a/Z3@\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"variables_get\" id=\";Ep_.z:zo3$lLXE*3yfr\"><field name=\"VAR\" id=\"%+DmH_?ZAYP|:7!csFYa\">angel0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"@lPv[-LPah|Tmz?FPta|\"><field name=\"NUM\">10</field></block></value></block></value></block></next></block></next></block></statement></block><block type=\"procedures_defnoreturn\" id=\"z1L[eW)!mFs]{WYOV3)b\" collapsed=\"true\" x=\"810\" y=\"250\"><field name=\"NAME\">calibrate_motor</field><statement name=\"STACK\"><block type=\"variables_set\" id=\"QJB8_cduJz{kw=RK%4,x\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field><value name=\"VALUE\"><block type=\"basex_get_encoder\" id=\"d(F{p[e?cvznL)opYLeO\"><field name=\"POS\">1</field></block></value><next><block type=\"controls_repeat\" id=\"OD/icWl~DO$K(-3h3Hc`\"><field name=\"TIMES\">9</field><statement name=\"DO\"><block type=\"variables_set\" id=\"{u`C%lq[F!C$G.`XTork\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"VoO].6v`l[C!U0+hb([$\"><field name=\"OP\">ADD</field><value name=\"A\"><block type=\"variables_get\" id=\"!uPlDKSK},mZOt0LJq1C\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field></block></value><value name=\"B\"><block type=\"basex_get_encoder\" id=\"m*]si8rj]*$zw[]CtNBC\"><field name=\"POS\">1</field></block></value></block></value><next><block type=\"timer_delay_ms\" id=\"gLgO=|c2{|fjkk|i?!(J\"><value name=\"DELAY\"><shadow type=\"math_number\" id=\"QIMVH^`q5HUITJhl%Z`{\"><field name=\"NUM\">100</field></shadow></value></block></next></block></statement><next><block type=\"variables_set\" id=\"|Fwg]_n#VO}oJNZaJXu{\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"v)9{EG9`R|.Bx,l9ftEX\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"variables_get\" id=\"v.x.n:IJP%}G)FLW|Z*E\"><field name=\"VAR\" id=\"9Jk}6Ue^bIY.JD/tIKXF\">motor0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"6=mfa1uITHha%YoX`tJs\"><field name=\"NUM\">10</field></block></value></block></value></block></next></block></next></block></statement></block><block type=\"button_callback\" id=\"grxU=VxZk(L[^7hbBfRa\" x=\"810\" y=\"310\"><field name=\"BUTTON\">A</field><field name=\"EVENT\">wasPressed</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"$gw5CVGa^(sHaG,.:*2N\"><field name=\"VAR\" id=\"30.|zhA*dUz/sta6n@J-\">mode</field><value name=\"VALUE\"><block type=\"math_number\" id=\"1D=(gl2tN^Ncn@1i+Ay7\"><field name=\"NUM\">0</field></block></value></block></statement></block><block type=\"button_callback\" id=\"^s(a~@=i|BHL0.]nWOhl\" x=\"810\" y=\"390\"><field name=\"BUTTON\">B</field><field name=\"EVENT\">wasPressed</field><statement name=\"FUNC\"><block type=\"procedures_callnoreturn\" id=\"ubwLBQ)RxHqdT`]%2W1I\"><mutation name=\"calibrate\"></mutation></block></statement></block><block type=\"button_callback\" id=\"aNe^=Gv4ae.)Nm.z/vQ~\" x=\"810\" y=\"470\"><field name=\"BUTTON\">C</field><field name=\"EVENT\">wasPressed</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"p[KTWz{-b$HT1z:5Mkk3\"><field name=\"VAR\" id=\"30.|zhA*dUz/sta6n@J-\">mode</field><value name=\"VALUE\"><block type=\"math_number\" id=\"a|5T(.y],OV,lg02ki0b\"><field name=\"NUM\">1</field></block></value></block></statement></block>","Blockly.Remotes":[],"modules":[]}

Credits

Peng Hong Liem

Peng Hong Liem

7 projects • 5 followers

Comments