marcus
Published

Smart restock and temperature alert system

Our product aims to reduce the manual labour of staff and enhance experience and convenience of staff and customers in the midst of covid-19

IntermediateFull instructions provided24 hours152
Smart restock and temperature alert system

Things used in this project

Story

Read more

Code

UI flow, smart restock and temperature alert system (main.m5f)

Python
This is my product code.
{"components":[{"id":"____screen","createTime":1676040505693,"name":"screen","x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","backgroundImage":"","type":"screen"},{"id":"____buttonA","createTime":1676040505693,"name":"ButtonA","buttonIndex":0,"x":35,"y":216,"width":64,"height":24,"text":"ButtonA","visibility":false,"type":"button"},{"id":"____buttonB","createTime":1676040505693,"name":"ButtonB","buttonIndex":1,"x":125,"y":216,"width":64,"height":24,"text":"ButtonB","visibility":false,"type":"button"},{"id":"____buttonC","createTime":1676040505693,"name":"ButtonC","buttonIndex":2,"x":215,"y":216,"width":64,"height":24,"text":"ButtonC","visibility":false,"type":"button"},{"id":"dD0*B-_1uCxQ&_4N","createTime":1676040759999,"isCoreTwo":false,"isPaper":false,"name":"label0","x":167,"y":57,"color":"#FFFFFF","text":"Text","font":"lcd.FONT_DejaVu18","rotation":0,"type":"label","layer":4,"width":null,"height":null,"radius":null},{"id":"QyAPYXuc@2iYCm&M","createTime":1676040765225,"isCoreTwo":false,"isPaper":false,"name":"label1","x":100,"y":96,"color":"#FFFFFF","text":"Text","font":"lcd.FONT_DejaVu18","rotation":0,"type":"label","layer":5,"width":null,"height":null,"radius":null},{"id":"Ua@#MSb&m$1NX3=z","createTime":1676040769240,"isCoreTwo":false,"isPaper":false,"name":"label2","x":120,"y":148,"color":"#FFFFFF","text":"Text","font":"lcd.FONT_DejaVu18","rotation":0,"type":"label","layer":6,"width":null,"height":null,"radius":null}],"type":"fire","versions":"Beta","units":[{"id":"#sP7qEdbAEQ@^w!B","createTime":1676040551034,"hidden":false,"type":"env2","name":"env20","port":"A","default":["A","E","PAHUB","Custom"],"pb_port":[0,1,2,3,4,5],"new_pb_port":"0","user_port":["21","22"],"icon":"env2.png"},{"id":"h%khXs2eh80@GZww","createTime":1676040562765,"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","user_port":["21","22"],"icon":"tof.png"}],"hats":[],"blockly":"<block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"50\" y=\"50\"><next><block type=\"basic_on_loop\" id=\"S%A{S*|EL$nQF;!pUQ.;\"><statement name=\"LOOP\"><block type=\"label_set_text\" id=\"nhy-R)hGGa}[_+KYgdfp\"><field name=\"COMPONENT\">label0</field><value name=\"TEXT\"><shadow type=\"text\" id=\"3-oK.z/78TdX;hKm03tY\"><field name=\"TEXT\">Hello M5</field></shadow><block type=\"dht12_get_temperature\" id=\"X7d.2t[+(qka[F+^lG@s\"><field name=\"VARNAME\">env20</field></block></value><next><block type=\"controls_if\" id=\"HJV#+Hk;$1^91(h+SrRV\"><mutation elseif=\"5\"></mutation><value name=\"IF0\"><block type=\"logic_operation\" id=\"]LT5umC(kPJkvxv=a;o=\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"|YH,ktBSAhIbiZ,Ya$.O\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"|!2(c-)QZ%xEs0Elx9=C\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"3T?C/c~/d]dD%2/__pIM\"><field name=\"NUM\">300</field></block></value></block></value><value name=\"B\"><block type=\"logic_operation\" id=\"]1b?rKLx/m*s68tP8F%p\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"}rxwb~oIkz$qp_2~iEAb\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"I]xRdv3qfL.m1Yrd/(LH\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"rY-S0:Bh@6ekn{5N4hB@\"><field name=\"NUM\">19</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\"9+(fbzs]u_Ly,h{4~`TJ\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"P{QYj+82|=}+24N}CU}J\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"u.UgX=Bz,*B/Jq[sBzIc\"><field name=\"NUM\">23</field></block></value></block></value></block></value></block></value><statement name=\"DO0\"><block type=\"label_set_text\" id=\"BV[IsG5t@fhO5u(KK9(d\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"~,JcueGQ7-{^f^Pmq4U{\"><field name=\"TEXT\">Temperature is fine</field></shadow></value><next><block type=\"label_set_text\" id=\"E@7IFC_ewS}s[WEvSt_Q\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"MTwunwI]1p/6!bS5l5Tf\"><field name=\"TEXT\">Stock is full</field></shadow></value><next><block type=\"rgb_set_all\" id=\"y5RWyC-2Cym!Yf,vTd`Z\"><field name=\"COLOR\">#33ff33</field></block></next></block></next></block></statement><value name=\"IF1\"><block type=\"logic_operation\" id=\"cE.UA#VGi0Vw)dHq?}`x\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"h@z6-k/C[~VO7}$Op7g5\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"pf=ZkQWrwg7k1g`0_,+$\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"cgjz|rdSP,B8gr1R?`i*\"><field name=\"NUM\">300</field></block></value></block></value><value name=\"B\"><block type=\"logic_operation\" id=\"ja)F]Nw/PYOw,%LRmhw4\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"VgvjeWdV6^D;:m/K;(7C\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"g1;(2::BhORp!mv93[6^\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"vjClj*j(B-1ofH~:_zA^\"><field name=\"NUM\">19</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\"#LsJfK=*a8;e6X|ocif-\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\".G+;5O$0Bi@_RG~rEObd\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"k`s/a-pOac5{/^VSKMH}\"><field name=\"NUM\">23</field></block></value></block></value></block></value></block></value><statement name=\"DO1\"><block type=\"rgb_set_all\" id=\"ys0YAIRd`WqNbY:10#Lw\"><field name=\"COLOR\">#ff0000</field><next><block type=\"speaker_tone\" id=\"`!q}k]V2d=-BDF7?cCz8\"><value name=\"FREQ\"><shadow type=\"math_number\" id=\"!aCn{b{njKtzW8C749xJ\"><field name=\"NUM\">1800</field></shadow></value><value name=\"TIMEOUT\"><shadow type=\"math_number\" id=\"PG*!Z|jN!`Vad1k;f^0`\"><field name=\"NUM\">200</field></shadow></value><next><block type=\"speaker_vol\" id=\".AXS3C-(YGNaC%.KOR|v\"><value name=\"VOLUME\"><shadow type=\"math_number\" id=\"iR}DXPe87NvS%B8D!:ec\"><field name=\"NUM\">0.05</field></shadow></value><next><block type=\"label_set_text\" id=\"^2CG10JDRgFg-g)|j)aE\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"roI+(|[![$B4M.U!JhgS\"><field name=\"TEXT\">Temperature is fine</field></shadow></value><next><block type=\"label_set_text\" id=\"=gL_-Ve~tkvj+4=Yg97(\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"BOjTUEcxJm,$Mp?/$P?P\"><field name=\"TEXT\">retsock required</field></shadow></value></block></next></block></next></block></next></block></next></block></statement><value name=\"IF2\"><block type=\"logic_operation\" id=\"{Xzh-gZ`]16KLVK+Z{,*\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\",V}.7qucAjwl@%r),J|/\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"yFf:59la{|Op!MgARI:R\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"IqV!PTMuphhVb):`b5NN\"><field name=\"NUM\">19</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\":|^lCL_YD84)?!CNX0:M\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"b;P81Xq)m%/6Y6q~h0u4\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"L0X:A20GwK?k=K14tOg3\"><field name=\"NUM\">300</field></block></value></block></value></block></value><statement name=\"DO2\"><block type=\"rgb_set_all\" id=\"Uk[1yb2i/Rved^+biy0D\"><field name=\"COLOR\">#ff0000</field><next><block type=\"speaker_tone\" id=\"cdoZw[,85Qm,F)!/D?n-\"><value name=\"FREQ\"><shadow type=\"math_number\" id=\"zZqAKH`QCd(DE48OZ(J0\"><field name=\"NUM\">1800</field></shadow></value><value name=\"TIMEOUT\"><shadow type=\"math_number\" id=\"J-JRj5cNMLrP#]bk$mAe\"><field name=\"NUM\">200</field></shadow></value><next><block type=\"speaker_vol\" id=\"obp4c@mYF.?q[5/#`,2s\"><value name=\"VOLUME\"><shadow type=\"math_number\" id=\"r}XDM/wdZMKv1]SYS!pl\"><field name=\"NUM\">0.05</field></shadow></value><next><block type=\"label_set_text\" id=\"*0mG:VGgo}%}I0S?!hA8\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\",*o+j)Z8-Jzjp5-g6%ZL\"><field name=\"TEXT\">Temperature is too low</field></shadow></value><next><block type=\"label_set_text\" id=\"cPmIUcwiTscQWrqr1!4L\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"b5cZ?pjr8Xdi^Q^YY166\"><field name=\"TEXT\">Stock is full</field></shadow></value></block></next></block></next></block></next></block></next></block></statement><value name=\"IF3\"><block type=\"logic_operation\" id=\"EHV:^6D9LS77+EhgZrsm\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"*m?.}3fr_+2QzO%re=Di\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"-BqrT3_gUKKF:tQGq9|w\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"*WUCVf)u/:MP+{JMe]]A\"><field name=\"NUM\">23</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\"cRK[rs,hu5zCL7=fxtF.\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"2EL?g^S)L|sE[/:Sft~.\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"k}RtlC(p%G8,$#LTtA}b\"><field name=\"NUM\">300</field></block></value></block></value></block></value><statement name=\"DO3\"><block type=\"rgb_set_all\" id=\"o4AeK@SxZ]dLiV#`gn=2\"><field name=\"COLOR\">#ff0000</field><next><block type=\"speaker_tone\" id=\"vW{*F$`}ypz}H(#aVboA\"><value name=\"FREQ\"><shadow type=\"math_number\" id=\"xvCINpwCQI%_yC!l|,sR\"><field name=\"NUM\">1800</field></shadow></value><value name=\"TIMEOUT\"><shadow type=\"math_number\" id=\"UKXcTUJ;,[*HY{c*O,57\"><field name=\"NUM\">200</field></shadow></value><next><block type=\"speaker_vol\" id=\"xh-d1qN%UW{Ex~WE74iQ\"><value name=\"VOLUME\"><shadow type=\"math_number\" id=\"dCn!7[4!)1!*!^tAx4Pl\"><field name=\"NUM\">0.05</field></shadow></value><next><block type=\"label_set_text\" id=\"-WeDz}]$LMFWm_A/z].w\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"3ab8_}F5MOhG.22!9q-1\"><field name=\"TEXT\">Temperature is too high</field></shadow></value><next><block type=\"label_set_text\" id=\"t~/{tX3hgrEtg`H[CYRM\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"DnG_8`6?Z,$iIPwbZf0A\"><field name=\"TEXT\">Stock is full</field></shadow></value></block></next></block></next></block></next></block></next></block></statement><value name=\"IF4\"><block type=\"logic_operation\" id=\"j_b6LzfV5ZxAi}eJ3h}!\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"q[%N~,#gLGyuOP^tu`1l\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"gc7xdrOiIL)#B`9LM[D~\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"yKGsXVVIR{;HOR{/^sjB\"><field name=\"NUM\">19</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\"_5(qV.j;XQ2`U+iqZl|`\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"=#cvwKzLZ~S0PdF6Xf]x\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"SkW9l_@oZ~Sx2fakkxZ?\"><field name=\"NUM\">300</field></block></value></block></value></block></value><statement name=\"DO4\"><block type=\"rgb_set_all\" id=\"kWEYzjXjamX?M+W,A8Q}\"><field name=\"COLOR\">#ff0000</field><next><block type=\"speaker_tone\" id=\"4#ueWZo;8(Lh~O;A7-c~\"><value name=\"FREQ\"><shadow type=\"math_number\" id=\"_9M2K@U@-)[(o2Cj4o%[\"><field name=\"NUM\">1800</field></shadow></value><value name=\"TIMEOUT\"><shadow type=\"math_number\" id=\"IKc.W6V_0Gtn~-fRR.Es\"><field name=\"NUM\">200</field></shadow></value><next><block type=\"speaker_vol\" id=\"t|R]~f*?!T0ZAw3$F)c6\"><value name=\"VOLUME\"><shadow type=\"math_number\" id=\"%RmhO2ECFiT+B^jB`xdy\"><field name=\"NUM\">0.05</field></shadow></value><next><block type=\"label_set_text\" id=\"d.y{kp-rw@^@on}6T-Sk\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"(*;$Et+fa?p5(aJPex,r\"><field name=\"TEXT\">Temperature is too low</field></shadow></value><next><block type=\"label_set_text\" id=\"pL|jzl*Y%QfVTIu$%7*E\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"Vhe!?(X0[Wx`$1GvecR~\"><field name=\"TEXT\">Restock is required</field></shadow></value></block></next></block></next></block></next></block></next></block></statement><value name=\"IF5\"><block type=\"logic_operation\" id=\"^i^+b}{2/r4U[F:Ed(gV\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_compare\" id=\"_Q+WROR,OcqbuitL}eQw\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"dht12_get_temperature\" id=\"Y{X)/XwU.vS|pXdfYf|3\"><field name=\"VARNAME\">env20</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"-;-41SO4B+~DtC|f]svF\"><field name=\"NUM\">23</field></block></value></block></value><value name=\"B\"><block type=\"logic_compare\" id=\"s2{;:k61R{krU|U}=GQ~\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"unit_tof_state\" id=\"+l#%6gDFjU8=`#E@+)4G\"><field name=\"TOF\">tof0</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"!^{vVq6Wp`]9+;M5%y8X\"><field name=\"NUM\">300</field></block></value></block></value></block></value><statement name=\"DO5\"><block type=\"rgb_set_all\" id=\"}{IMm(crAVE{5Ir)yu@!\"><field name=\"COLOR\">#ff0000</field><next><block type=\"speaker_tone\" id=\"pG3ZdHCih!b4q$AGh8$l\"><value name=\"FREQ\"><shadow type=\"math_number\" id=\"C{1#EW,c:+e{H$x^kNsF\"><field name=\"NUM\">1800</field></shadow></value><value name=\"TIMEOUT\"><shadow type=\"math_number\" id=\"2}#RB6B8`2TCCqk~@Upc\"><field name=\"NUM\">200</field></shadow></value><next><block type=\"speaker_vol\" id=\"HugyoNz}*wb#]|JwwT6F\"><value name=\"VOLUME\"><shadow type=\"math_number\" id=\"54~*Pa-ob)[OYO;D0YUM\"><field name=\"NUM\">0.05</field></shadow></value><next><block type=\"label_set_text\" id=\"tmcgSaF{-b,26?O,Erbd\"><field name=\"COMPONENT\">label1</field><value name=\"TEXT\"><shadow type=\"text\" id=\"2f3(jjiuQ`!]oStaah*o\"><field name=\"TEXT\">Temperature is too high</field></shadow></value><next><block type=\"label_set_text\" id=\"K[M*[25ecdkJ]kg{s,L(\"><field name=\"COMPONENT\">label2</field><value name=\"TEXT\"><shadow type=\"text\" id=\"$0j9uca|#Z:zrWjA3kR=\"><field name=\"TEXT\">Restock is required</field></shadow></value></block></next></block></next></block></next></block></next></block></statement></block></next></block></statement></block></next></block>","Blockly.Remotes":[],"modules":["rgb"]}

Credits

marcus

marcus

1 project • 0 followers

Comments