RosarIoT
Created September 2, 2021

Smart Train IoT

How to recycle a toy locomotive with a ESP8266?

IntermediateFull instructions provided4 hours1
Smart Train IoT

Things used in this project

Hardware components

M5Stack Core2 ESP32 IoT Development Kit
M5Stack Core2 ESP32 IoT Development Kit
×1
Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Wemos Motor Shield
×1
Wemos Battery Shield
×1
Buzzer
Buzzer
×1
Infrared Module (Generic)
×1
LED (generic)
LED (generic)
×1

Story

Read more

Schematics

Diagram

Code

smart_train_mqtt.m5f

Scratch
{"components":[{"id":"_coretwoscreen","createTime":1618240904264,"name":"screen","x":0,"y":0,"width":320,"height":240,"backgroundColor":"#FFFFFF","backgroundImage":"","type":"screen"},{"id":"____buttonA","createTime":1618240904264,"name":"ButtonA","buttonIndex":0,"x":35,"y":216,"width":64,"height":24,"text":"ButtonA","visibility":false,"type":"button"},{"id":"____buttonB","createTime":1618240904264,"name":"ButtonB","buttonIndex":1,"x":125,"y":216,"width":64,"height":24,"text":"ButtonB","visibility":false,"type":"button"},{"id":"____buttonC","createTime":1618240904264,"name":"ButtonC","buttonIndex":2,"x":215,"y":216,"width":64,"height":24,"text":"ButtonC","visibility":false,"type":"button"},{"id":"%#ry8i1BiXcNPQ19","createTime":1618240997155,"name":"swtLight","x":2,"y":163,"width":70,"height":30,"color":"#FFFFFF","selectedColor":"#0288FB","unselectedColor":"#CCCCCC","type":"switch","layer":5},{"id":"as2G5`%&%rGsm5L7","createTime":1618241013924,"name":"btnBuzzer","x":90,"y":200,"width":70,"height":30,"r":50,"text":"Buzzer","font":"FONT_MONT_14","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":7},{"id":"&7*5^t_pj39q0yuQ","createTime":1618241722700,"isCoreTwo":true,"isPaper":false,"name":"lblMotor","x":2,"y":61,"color":"#000","text":"Motor","font":"FONT_UNICODE_24","rotation":0,"type":"label","layer":9},{"id":"sVmS-27ag&RpTAfa","createTime":1618241722700,"isCoreTwo":true,"isPaper":false,"name":"lblBuzzer","x":2,"y":203,"color":"#000","text":"Buzzer","font":"FONT_UNICODE_24","rotation":0,"type":"label","layer":10},{"id":"!#EW#2jppEago4es","createTime":1618241722700,"isCoreTwo":true,"isPaper":false,"name":"label1","x":2,"y":131,"color":"#000","text":"Light","font":"FONT_UNICODE_24","rotation":0,"type":"label","layer":11},{"id":"8sg#TU_Hs`_Ewh4e","createTime":1618241837781,"isCoreTwo":true,"name":"line0","x":5,"y":46,"x1":5,"y1":46,"x2":310,"y2":46,"width":50,"color":"#000","lineWidth":1,"type":"line","layer":12},{"id":"X1@Q!fc=eDF&p^@c","createTime":1618241915594,"isCoreTwo":true,"isPaper":false,"name":"lblTitle","x":2,"y":10,"color":"#000","text":"Smart Train Control ","font":"FONT_MONT_28","rotation":0,"type":"label","layer":14},{"id":"dD1U7mVmyuGGDWp&","createTime":1618240997155,"name":"swtMotor","x":2,"y":91,"width":70,"height":30,"color":"#FFFFFF","selectedColor":"#0288FB","unselectedColor":"#CCCCCC","type":"switch","layer":17},{"id":"9wvK0=$s16*C0MFy","createTime":1618248459656,"name":"chkReverse","x":88,"y":93,"color":"#000","selectedColor":"#000","text":"R","font":"FONT_UNICODE_24","type":"checkbox","layer":14},{"id":"XseO3si#6$!O-+pk","createTime":1618253130194,"isCoreTwo":true,"isPaper":false,"name":"lblSpeed","x":219,"y":92,"color":"#000","text":"0","font":"FONT_UNICODE_24","rotation":0,"type":"label","layer":15},{"id":"EKigCYNcRTZs!nVs","createTime":1618511126465,"name":"btnMotorMin","x":167,"y":91,"width":45,"height":30,"r":50,"text":"-","font":"FONT_UNICODE_24","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":17},{"id":"j2%ZwZM154MPR@J@","createTime":1618511126465,"name":"btnMotorMax","x":255,"y":91,"width":45,"height":30,"r":50,"text":"+","font":"FONT_UNICODE_24","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":18},{"id":"9pnKyJ&-BRzLPq7C","createTime":1618515349437,"name":"btnHigh","x":90,"y":163,"width":70,"height":30,"r":50,"text":"HIGH","font":"FONT_MONT_14","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":24},{"id":"0@JKb3c`3+em3+0&","createTime":1618515349437,"name":"btnMedium","x":167,"y":163,"width":70,"height":30,"r":50,"text":"MEDIUM","font":"FONT_MONT_14","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":25},{"id":"8C`^mqgq3nu*A8AP","createTime":1618515349437,"name":"btnSlow","x":244,"y":163,"width":70,"height":30,"r":50,"text":"SLOW","font":"FONT_MONT_14","color":"#000000","borderColor":"#01a2b1","backgroundColor":"#FFFFFF","type":"touch_button","layer":26}],"type":"core2","versions":"Beta","units":[],"hats":[],"blockly":"<variables><variable id=\"wVbV9AP!-l(HEDv)ww4r\">speed</variable><variable id=\"Nce%li9DccP$Peoszv+.\">reverse</variable></variables><block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"71\" y=\"-209\"><next><block type=\"wifi_doConnect\" id=\"r@0W+;]R79=}cj|:thgj\"><value name=\"apiKey\"><shadow type=\"text\" id=\"ySWPuYNCME1I+u=gH|1z\"><field name=\"TEXT\">ssid_example</field></shadow></value><value name=\"Msg\"><shadow type=\"text\" id=\"Cy)W[awWUW+OwwZ9_t0f\"><field name=\"TEXT\">pass_ssid_example</field></shadow></value><next><block type=\"mqtt_set_client\" id=\"+TaG|+I]3`:LEuoxmfDJ\"><value name=\"ID\"><shadow type=\"text\" id=\"~EvWrmRus|aceTHS}=#|\"><field name=\"TEXT\">locomotive</field></shadow></value><value name=\"SERVER\"><shadow type=\"text\" id=\"?s0J,@o%SGyGMSIb}ZhP\"><field name=\"TEXT\">mqtt.example.com</field></shadow></value><value name=\"PORT\"><shadow type=\"math_number\" id=\"ON)A-91_o`k-iTWbb8@Q\"><field name=\"NUM\">1883</field></shadow></value><value name=\"USER\"><shadow type=\"text\" id=\":$:qu:*Gc!^fzkMSMgQp\"><field name=\"TEXT\">mqtt_user_example</field></shadow></value><value name=\"PASSWORD\"><shadow type=\"text\" id=\"*8*:/a!wdtw_+tv6XHY:\"><field name=\"TEXT\">mqtt_pass_example!</field></shadow></value><value name=\"KEEPALIVE\"><shadow type=\"math_number\" id=\",H06GnK(k@x8h[$AA=={\"><field name=\"NUM\">300</field></shadow></value><next><block type=\"button_set_hidden\" id=\"`+/}|hHt:K$vZd||(/oV\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"mTd=,v7eA8(~vm9#ro,t\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"W~7NSFE{g][Ua1wIOT,e\"><field name=\"COMPONENT\">btnHigh</field><field name=\"MODE\">True</field><next><block type=\"button_set_bgcolor\" id=\";Ds7}]#%Zm-6g?3dOIe@\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_hidden\" id=\"d,WzQcr{/XaA;}+@9$d+\"><field name=\"COMPONENT\">btnMedium</field><field name=\"MODE\">True</field><next><block type=\"button_set_bgcolor\" id=\"o/R(@FLg1^1HoW)7]0Ld\"><field name=\"COMPONENT\">btnMedium</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_hidden\" id=\"~WfiA~X`cRKS@0-W~94X\"><field name=\"COMPONENT\">btnSlow</field><field name=\"MODE\">True</field><next><block type=\"button_set_bgcolor\" id=\"DDREJuAI:[W8tC`sE+rr\"><field name=\"COMPONENT\">btnSlow</field><field name=\"COLOR\">#ffffff</field><next><block type=\"checkbox_set_checked\" id=\"8%C;(vMI./7-Ngpna$5b\"><field name=\"COMPONENT\">chkReverse</field><field name=\"state\">False</field><next><block type=\"label_set_mode\" id=\"DxLl]0b,}xtfP~:mt3gc\"><field name=\"COMPONENT\">lblSpeed</field><field name=\"MODE\">True</field><next><block type=\"variables_set\" id=\";kF6%0Q_|c}l?`0mXG.A\"><field name=\"VAR\" id=\"Nce%li9DccP$Peoszv+.\">reverse</field><value name=\"VALUE\"><block type=\"logic_boolean\" id=\"t#28D!9IiUJx;Qv=Z1ll\"><field name=\"BOOL\">FALSE</field></block></value><next><block type=\"variables_set\" id=\"f`az,}mo2nxV73T9{Du#\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_number\" id=\"}b#mF~jB#.H.F%Uq6xxb\"><field name=\"NUM\">30</field></block></value><next><block type=\"mqtt_start\" id=\"CsZ5PuC/`!sM=a`XBr4/\"></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><block type=\"wifi_doConnect\" id=\"Ud3Qc.0AT.r3TuL7@:g5\" disabled=\"true\" x=\"99\" y=\"-128\"><value name=\"apiKey\"><shadow type=\"text\" id=\"ahrMSth}M!.d7$eA0C:J\"><field name=\"TEXT\">HITRON2.4G-1C7C70</field></shadow></value><value name=\"Msg\"><shadow type=\"text\" id=\"^m(CjY$R/WM_FDQ#U*I_\"><field name=\"TEXT\">Pampa.1989k</field></shadow></value></block><block type=\"mqtt_sub\" id=\"|TE-,!C(y(Cz,EzT`;sA\" x=\"370\" y=\"-130\"><value name=\"FROM\"><shadow type=\"text\" id=\"qseF[8_hiG!7r8160kjb\"><field name=\"TEXT\">ESP_Easy/#</field></shadow></value></block><block type=\"button_set_cb\" id=\"v){oQf^|T;#RJb|d3AG@\" x=\"71\" y=\"431\"><field name=\"COMPONENT\">btnBuzzer</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"mqtt_publish\" id=\"kKmkrCbQU)$^+jPjBQ@T\"><value name=\"FROM\"><shadow type=\"text\" id=\"-JjPEB=*%y^lB#LAJR*F\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"SJF5y7t$OFf$J#hpDi2/\"><field name=\"TEXT\">tone,14,1400,750</field></shadow></value></block></statement></block><block type=\"switch_set_cb\" id=\"6Mc#:cBvJ9yt[Ig(2YZi\" x=\"70\" y=\"531\"><field name=\"COMPONENT\">swtLight</field><field name=\"EVENT\">on</field><statement name=\"FUNC\"><block type=\"button_set_hidden\" id=\"xH:ECV5$w=#w)NC9iaW}\"><field name=\"COMPONENT\">btnHigh</field><field name=\"MODE\">False</field><next><block type=\"button_set_hidden\" id=\"|C;7P}we^}SPlJuf3sKd\"><field name=\"COMPONENT\">btnMedium</field><field name=\"MODE\">False</field><next><block type=\"button_set_hidden\" id=\"Rg#kZ=|x~-Jbt5-:+z29\"><field name=\"COMPONENT\">btnSlow</field><field name=\"MODE\">False</field><next><block type=\"button_set_bgcolor\" id=\"VCmQ0302XziU{6wC]Pt)\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#33ccff</field><next><block type=\"mqtt_publish\" id=\"vUFu6)xzf#h60Wj[?ECX\"><value name=\"FROM\"><shadow type=\"text\" id=\"evr(RUnOrd4=8!WQtsiv\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"D1Sr(RnSxw/xPuY?CI._\"><field name=\"TEXT\">PWM,12,500</field></shadow></value></block></next></block></next></block></next></block></next></block></statement></block><block type=\"switch_set_cb\" id=\"{IJU*uf,UUy?Ebg6Q.z+\" x=\"390\" y=\"531\"><field name=\"COMPONENT\">swtLight</field><field name=\"EVENT\">off</field><statement name=\"FUNC\"><block type=\"button_set_hidden\" id=\"3h*g=Kb9c^rN~-^;l[*U\"><field name=\"COMPONENT\">btnHigh</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"`|pJNKclDcfKeXBBa)FU\"><field name=\"COMPONENT\">btnMedium</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"/a#jFDNGA}8Tm@-!{nez\"><field name=\"COMPONENT\">btnSlow</field><field name=\"MODE\">True</field><next><block type=\"button_set_bgcolor\" id=\"K5M%K/Q_mkrWbCy*qmk4\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_bgcolor\" id=\"Opl~Ato4xdmPiC4]/709\"><field name=\"COMPONENT\">btnMedium</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_bgcolor\" id=\"XtSv.dBG/41i[@*MC5cc\"><field name=\"COMPONENT\">btnSlow</field><field name=\"COLOR\">#ffffff</field><next><block type=\"mqtt_publish\" id=\"b)ZHqbx8.RM|g|:wOUaL\"><value name=\"FROM\"><shadow type=\"text\" id=\"q-oo2?tyrtvh5-9Ygrm*\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"6?Te_?Nm0_(M^p?jf20U\"><field name=\"TEXT\">PWM,12,0</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type=\"checkbox_set_cb\" id=\"ISh6Xy1)kFrl[z/s]:8j\" x=\"71\" y=\"770\"><field name=\"COMPONENT\">chkReverse</field><field name=\"EVENT\">checked</field><statement name=\"FUNC\"><block type=\"label_set_mode\" id=\"e+MZy.Q1p+.=s1j9T6f;\"><field name=\"COMPONENT\">lblSpeed</field><field name=\"MODE\">True</field><next><block type=\"variables_set\" id=\"pUkoVp4]M|9@:b7A2u2v\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_number\" id=\"Om;t:A5e#{@nq`WM%Nsg\"><field name=\"NUM\">26</field></block></value><next><block type=\"switch_set_off\" id=\"%`Eiu}pd/w*hM(-0?uX2\"><field name=\"COMPONENT\">swtMotor</field><next><block type=\"button_set_hidden\" id=\"l[jkL:76^XBKsU542+=W\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"a#g,7@TDYrQ[@4XpWK]1\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">True</field><next><block type=\"mqtt_publish\" id=\"Wns|,IV5:VVR9@gR,H!8\"><value name=\"FROM\"><shadow type=\"text\" id=\"XA^`?|BjrG7{N%;cP6yy\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"j2J8b.8?^jZC`^JqBw0G\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Backward,30</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type=\"checkbox_set_cb\" id=\"=2B6aQ)hCDuo#JWrcr|D\" x=\"390\" y=\"771\"><field name=\"COMPONENT\">chkReverse</field><field name=\"EVENT\">unchecked</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"re9lrK,3t$j./=4BCK@g\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_number\" id=\"NOCg|#oKd2%2Lo0[(:O(\"><field name=\"NUM\">0</field></block></value><next><block type=\"switch_set_off\" id=\"|IV7#TX^Cbf*ts*lbp1I\"><field name=\"COMPONENT\">swtMotor</field><next><block type=\"button_set_hidden\" id=\"9BdIO|x=p.lFh3|C!:5X\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"]o)02jt(rL1KSE$tl1i4\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field><next><block type=\"mqtt_publish\" id=\"?]~W.:_;16#m8P(+/0^B\"><value name=\"FROM\"><shadow type=\"text\" id=\"CTMoW/**Bw/VZl2V]hOz\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"-Q9|SYZvSR+gWmQ(;zMn\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Stop</field></shadow></value></block></next></block></next></block></next></block></next></block></statement></block><block type=\"switch_set_cb\" id=\"KH[bWhFh(a@BR1?3fhWI\" x=\"70\" y=\"990\"><field name=\"COMPONENT\">swtMotor</field><field name=\"EVENT\">on</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"s+Fe%-n1*-Boyw:nMT$^\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_number\" id=\"`X8OU=^87lKIt:W1P?]s\"><field name=\"NUM\">50</field></block></value><next><block type=\"button_set_hidden\" id=\"5eJthpBB;a}=YycHw6c}\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">False</field><next><block type=\"button_set_hidden\" id=\"Ys/v!%%8i6O@)XjJ/+oh\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">False</field><next><block type=\"checkbox_set_checked\" id=\"y4R#MQn9WX/)/Y.p,Y_y\"><field name=\"COMPONENT\">chkReverse</field><field name=\"state\">False</field><next><block type=\"mqtt_publish\" id=\"3::nc)(Oj;pgC(5.M#Yz\"><value name=\"FROM\"><shadow type=\"text\" id=\"DkeL:`-]TiH`Psop5hP~\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"BKLlQY/G#m}*Mh*{L~.Q\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Forward,50</field></shadow></value></block></next></block></next></block></next></block></next></block></statement></block><block type=\"switch_set_cb\" id=\"d)^ZGaIasIq5ic[J@1`a\" x=\"410\" y=\"991\"><field name=\"COMPONENT\">swtMotor</field><field name=\"EVENT\">off</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"3;aj^M$6..D2P42Xeq;f\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_number\" id=\"-TxByj_KD1CSirzTzPBQ\"><field name=\"NUM\">0</field></block></value><next><block type=\"button_set_hidden\" id=\"U8[s0HP=W4hQ+YVmvt/1\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field><next><block type=\"button_set_hidden\" id=\"ib1l?pxyr!`MLOu[Jvq=\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">True</field><next><block type=\"checkbox_set_checked\" id=\"rMqZxK)=yW~!(PgiT4SM\"><field name=\"COMPONENT\">chkReverse</field><field name=\"state\">False</field><next><block type=\"mqtt_publish\" id=\"z]x?R(3*(v8.ux5!%Rb`\"><value name=\"FROM\"><shadow type=\"text\" id=\"-JKD,^^sXJZ_GcAv@p_C\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"$sjE#ff3R3N6Ft9*aCL{\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Stop</field></shadow></value></block></next></block></next></block></next></block></next></block></statement></block><block type=\"button_set_cb\" id=\"#TVPdjPjR5|*-M@ymz`%\" x=\"70\" y=\"1190\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"(hMWH*4q4_(Htc9g)VC:\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"rv}eY`eiT6,d0i(%6RVk\"><field name=\"OP\">ADD</field><value name=\"A\"><block type=\"variables_get\" id=\"YR19$a*C`r=^jiS;.aeG\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"+tez[!taF-LtAYK_,eMC\"><field name=\"NUM\">10</field></block></value></block></value><next><block type=\"controls_if\" id=\"B{n6oYf+WyK_P}IgF+Xt\"><mutation else=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"=4G0$A*%Wy=hbuJDM)5G\"><field name=\"OP\">LTE</field><value name=\"A\"><block type=\"variables_get\" id=\":?5hMOJiCA6qsOp%lnz5\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"aCLp[8Ju)kMLu^YYf%Wd\"><field name=\"NUM\">80</field></block></value></block></value><statement name=\"DO0\"><block type=\"button_set_hidden\" id=\"}6(Ay$?Pn74VU=0[s`jP\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">False</field><next><block type=\"mqtt_publish\" id=\"uwu{p9owAx[rm(Oxp-gG\"><value name=\"FROM\"><shadow type=\"text\" id=\"5z~]6~dywVH;]a9y_U[X\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"UcBP-[i|~i3|+=c1!Z=a\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Forward,30</field></shadow><block type=\"text_add\" id=\"zi9IL5qQw-L%gaas=xX%\"><value name=\"arg0\"><shadow type=\"text\" id=\"ZAp`*Aa[bNc`b[*zVm:+\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Forward,</field></shadow></value><value name=\"arg1\"><block type=\"variables_get\" id=\"OIo}l.!.eEAjBdgyXk?z\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value></block></value></block></next></block></statement><statement name=\"ELSE\"><block type=\"button_set_hidden\" id=\"%SeK*4KOc*^@}slSu%m*\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">True</field></block></statement></block></next></block></statement></block><block type=\"button_set_cb\" id=\".H86i=EMOi@YB@aftwLz\" x=\"410\" y=\"1190\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"variables_set\" id=\"~([$?Z/rie{M*c|(+3E_\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field><value name=\"VALUE\"><block type=\"math_arithmetic\" id=\"Bw4ZJC)Pq*f**fsQ^qU^\"><field name=\"OP\">MINUS</field><value name=\"A\"><block type=\"variables_get\" id=\"zvh`VAdBbEy~tr3{S%M:\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"]P(f~$MAHa|hc{/V`URH\"><field name=\"NUM\">10</field></block></value></block></value><next><block type=\"controls_if\" id=\"ozEDDNcrL?jT^zQxh@^Y\"><mutation else=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"9tbg;NSwcBB-x(Y~_UBc\"><field name=\"OP\">GTE</field><value name=\"A\"><block type=\"variables_get\" id=\"vaE3,b}nD0yPw)AZW/MS\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"#v~y$@V]2QZMM}d9I7bG\"><field name=\"NUM\">40</field></block></value></block></value><statement name=\"DO0\"><block type=\"button_set_hidden\" id=\"+*rw:[NIU|2.[]UvTx66\"><field name=\"COMPONENT\">btnMotorMax</field><field name=\"MODE\">False</field><next><block type=\"mqtt_publish\" id=\"-18@2rRfOA6OC~DINT22\"><value name=\"FROM\"><shadow type=\"text\" id=\"0hMGFQ$~br-(-CXo/7#R\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Forward,30</field></shadow><block type=\"text_add\" id=\"e,~dAY-v_:82y?/K3(+p\"><value name=\"arg0\"><shadow type=\"text\" id=\"X*N8vCEN;KTYJ(C)=FEW\"><field name=\"TEXT\">WemosMotorShieldCMD,0,Forward,</field></shadow></value><value name=\"arg1\"><block type=\"variables_get\" id=\"Gw_GTDxgvG8^qiUyg%~i\"><field name=\"VAR\" id=\"wVbV9AP!-l(HEDv)ww4r\">speed</field></block></value></block></value></block></next></block></statement><statement name=\"ELSE\"><block type=\"button_set_hidden\" id=\"g#LX{UQw^=RQkABX7s#8\"><field name=\"COMPONENT\">btnMotorMin</field><field name=\"MODE\">True</field></block></statement></block></next></block></statement></block><block type=\"button_set_cb\" id=\"Vp^yM%w{PA!pQllWWUu5\" x=\"70\" y=\"1451\"><field name=\"COMPONENT\">btnHigh</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"button_set_bgcolor\" id=\"Lt$Tl!G]ykI.@)|h=+K~\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#33ccff</field><next><block type=\"button_set_bgcolor\" id=\";u#8C|KzAV1ml!1(.L/g\"><field name=\"COMPONENT\">btnMedium</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_bgcolor\" id=\"NwcVyFRLjlHRhENExl-a\"><field name=\"COMPONENT\">btnSlow</field><field name=\"COLOR\">#ffffff</field><next><block type=\"mqtt_publish\" id=\"Ra-@2[glbFW!ebFhOFPx\"><value name=\"FROM\"><shadow type=\"text\" id=\"Ii8ZuIv1XrLPqbO8qBYH\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\",~?{gnc*B{$fkQMn+kvZ\"><field name=\"TEXT\">PWM,12,700</field></shadow></value></block></next></block></next></block></next></block></statement></block><block type=\"button_set_cb\" id=\"s{QAyrpemc))1iNZqr=v\" x=\"270\" y=\"1450\"><field name=\"COMPONENT\">btnMedium</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"button_set_bgcolor\" id=\"pwyn4t6y}:+|IBZV|42.\"><field name=\"COMPONENT\">btnMedium</field><field name=\"COLOR\">#33ccff</field><next><block type=\"button_set_bgcolor\" id=\"FS#rP=Ch6azqdEj_WkWU\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_bgcolor\" id=\"(6Ux{MOI~t=g{*cxY{wq\"><field name=\"COMPONENT\">btnSlow</field><field name=\"COLOR\">#ffffff</field><next><block type=\"mqtt_publish\" id=\"Gg|7-DM+[+1NUdbV4@Dh\"><value name=\"FROM\"><shadow type=\"text\" id=\"^F$!m]eL.$9`c,QOyNyX\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"T=qnp,%[$^3H33G,gJEt\"><field name=\"TEXT\">PWM,12,250</field></shadow></value></block></next></block></next></block></next></block></statement></block><block type=\"button_set_cb\" id=\"`XuW#R@4QU)|NMv:1T:-\" x=\"491\" y=\"1450\"><field name=\"COMPONENT\">btnSlow</field><field name=\"EVENT\">pressed</field><statement name=\"FUNC\"><block type=\"button_set_bgcolor\" id=\"L5q?n]MSqm^FABajmzr.\"><field name=\"COMPONENT\">btnSlow</field><field name=\"COLOR\">#33ccff</field><next><block type=\"button_set_bgcolor\" id=\"hj4I]gh7zhFwf@89kkmT\"><field name=\"COMPONENT\">btnHigh</field><field name=\"COLOR\">#ffffff</field><next><block type=\"button_set_bgcolor\" id=\"|:tMuV:kL!=4|7=i3a3y\"><field name=\"COMPONENT\">btnMedium</field><field name=\"COLOR\">#ffffff</field><next><block type=\"mqtt_publish\" id=\"K{G$/XBJ^(BU`+tns25p\"><value name=\"FROM\"><shadow type=\"text\" id=\"aPA9ATKCKmF.{`Ydz4tt\"><field name=\"TEXT\">ESP_Easy/cmd</field></shadow></value><value name=\"MSG\"><shadow type=\"text\" id=\"!tNDBZYDlzh|W9sAS%3%\"><field name=\"TEXT\">PWM,12,75</field></shadow></value></block></next></block></next></block></next></block></statement></block>","Blockly.Remotes":[],"modules":[]}

Credits

RosarIoT

RosarIoT

0 projects • 0 followers

Comments