Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab4be6b

Browse files
pandiannanolbuque
authored andcommitted
Docs Bugs: Missing the docs & examples.
Signed-off-by: Pandian Nano <pandian.nano@gmail.com>
1 parent50fb458 commitab4be6b

File tree

12 files changed

+171
-9
lines changed

12 files changed

+171
-9
lines changed

‎docs/en/refs/unit.mqtt.ref‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
.. |get_topic.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mqtt/get_topic.png
2525
.. |get_msg.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mqtt/get_msg.png
2626

27-
.. |mqttunit_demo.m5f2| raw:: html
27+
.. |mqtt_demo.m5f2| raw:: html
2828

2929
<a
30-
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/mqtt/mqttunit_demo.m5f2"
30+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/mqtt/mqtt_demo.m5f2"
3131
target="_blank"
3232
>
33-
mqttunit_demo.m5f2
33+
mqtt_demo.m5f2
3434
</a>
3535

3636

‎docs/en/refs/unit.mqttpoe.ref‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
.. |get_topic.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mqtt_poe/get_topic.png
2525
.. |get_msg.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mqtt_poe/get_msg.png
2626

27-
.. |mqttpoeunit_demo.m5f2| raw:: html
27+
.. |mqttpoe_demo.m5f2| raw:: html
2828

2929
<a
30-
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/mqtt_poe/mqttpoeunit_demo.m5f2"
30+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/mqtt_poe/mqttpoe_demo.m5f2"
3131
target="_blank"
3232
>
33-
mqttpoeunit_demo.m5f2
33+
mqttpoe_demo.m5f2
3434
</a>
3535

3636

‎docs/en/refs/unit.weight_i2c.ref‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@
3434
.. |get_device_spec.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_device_spec.svg
3535

3636
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/example.svg
37+
38+
.. |weight-i2c-demo.m5f2| raw:: html
39+
40+
<a
41+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/weight_i2c/weight-i2c-demo.m5f2"
42+
target="_blank"
43+
>
44+
weight-i2c-demo.m5f2
45+
</a>

‎docs/en/units/mqtt.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ UIFLOW2 Example:
3838

3939
..only::builder_html
4040

41-
|mqttunit_demo.m5f2|
41+
|mqtt_demo.m5f2|
4242

4343

4444
class MQTTUnit

‎docs/en/units/mqttpoe.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ UIFLOW2 Example:
4242

4343
..only::builder_html
4444

45-
|mqttpoeunit_demo.m5f2|
45+
|mqttpoe_demo.m5f2|
4646

4747

4848
class MQTTPoEUnit

‎docs/en/units/weight_i2c.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ UIFLOW2 Example:
3232

3333
|example.svg|
3434

35-
3635
..only::builder_html
3736

37+
|weight-i2c-demo.m5f2|
38+
3839

3940
class WEIGHT_I2CUnit
4041
--------------------

‎examples/unit/mqtt/mqtt_demo.m5f2‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"V2.0","versionNumber":"V2.0.8","type":"cores3","components":[{"name":"screen","type":"screen","layer":0,"screenId":"builtin","screenName":"","id":"__cores3_screen","createTime":1720057143761,"x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","size":0,"isSelected":true}],"resources":[{"hardware":["hardware_button","hardware_pin_button","imu","speaker","touch","als","mic"]},{"unit":["unit_mqtt"]}],"units":[{"type":"unit_mqtt","name":"mqtt_0","portList":["A","B","C","Custom"],"portType":"C","userPort":[22,21],"id":"wGiO&zxOi9&W63te","createTime":1720057162500,"initBlockId":"nLz8AuKFQ28{59YU%UFx"}],"hats":[],"bases":[],"i2cs":[],"blockly":"<block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"-250\" y=\"-230\"><mutation isBegin=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_begin\" id=\"system_m5_begin\"><next><block type=\"unit_mqtt_init\" id=\"nLz8AuKFQ28{59YU%UFx\"><field name=\"NAME\">mqtt_0</field><next><block type=\"unit_mqtt_set_server_config\" id=\"}%TqN37ukD61_(6.duYp\"><field name=\"NAME\">mqtt_0</field><value name=\"ID\"><shadow type=\"text\" id=\"8(j=0$y3inYE9u.^]$MR\"><field name=\"TEXT\">m5-mqtt-xxx</field></shadow></value><value name=\"SERVER\"><shadow type=\"text\" id=\"4ncB,DOFP1AGMa+Paa5q\"><field name=\"TEXT\">mqtt.m5stack.com</field></shadow></value><value name=\"PORT\"><shadow type=\"math_number\" id=\"QaoW[q-]1`I?A~uhJ)hZ\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">1883</field></shadow></value><value name=\"USERNAME\"><shadow type=\"text\" id=\"2-CfK?mYSzyjt=yAzP%l\"><field name=\"TEXT\"></field></shadow></value><value name=\"PASSWORD\"><shadow type=\"text_password\" id=\":O]}v%Gt]),[n7VJmH|!\"><mutation show=\"true\"></mutation><field name=\"TEXT\"></field></shadow></value><value name=\"KEEPALIVE\"><shadow type=\"math_slider\" id=\"7#[V5T5ee*M1F60c-CvI\"><mutation max=\"65535\" min=\"0\" step=\"1\" precision=\"1\"></mutation><field name=\"NUM\">120</field></shadow></value><next><block type=\"unit_mqtt_set_connect\" id=\"w5-O%-xg/@FA#:^A2#H%\"><field name=\"NAME\">mqtt_0</field></block></next></block></next></block></next></block></statement></block><block type=\"unit_mqtt_subscribe_callback\" id=\"9(Y+h;FhL49,J)!s+@kx\" x=\"-250\" y=\"150\"><field name=\"NAME\">mqtt_0</field><value name=\"MSG\"><shadow type=\"text\" id=\"D{AWOC**@Au5Ug/ow?RX\"><field name=\"TEXT\">SubTopic</field></shadow></value><value name=\"QOS\"><shadow type=\"math_slider\" id=\"J43B~MXK#X7NIqbDmv:j\"><mutation max=\"2\" min=\"0\" step=\"1\" precision=\"1\"></mutation><field name=\"NUM\">0</field></shadow></value><statement name=\"FUNC\"><block type=\"text_print\" id=\"Sw2)uq]kFD+G.bqC;*`8\"><value name=\"TEXT\"><shadow type=\"text\" id=\"mioAB2fRKe3dkZs#=[tB\"><field name=\"TEXT\">hello M5</field></shadow><block type=\"unit_mqtt_get_topic\" id=\"Rrxgp^?7vK+8MPE@]dOt\"></block></value><next><block type=\"text_print\" id=\"hx#cikBV/BTfvESlyUk{\"><value name=\"TEXT\"><shadow type=\"text\" id=\"GleXUu!Lo.gyecBma)9T\"><field name=\"TEXT\">hello M5</field></shadow><block type=\"unit_mqtt_get_msg\" id=\"LB*ntk*m?IEt11`k0dWn\"></block></value></block></next></block></statement></block><block type=\"basic_on_loop\" id=\"loop_block\" deletable=\"false\" x=\"-250\" y=\"310\"><mutation isUpdate=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_update\" id=\"system_m5_update\"><next><block type=\"unit_mqtt_check_msg\" id=\"FI(onR`r`iHDy.3.:i_v\"><field name=\"NAME\">mqtt_0</field><next><block type=\"time_sleep_millisecond\" id=\":_VYZ~HOI]^LzgNJU6Z#\"><value name=\"MS\"><shadow type=\"math_number\" id=\"GXX;=IQSvWwOK::elKB^\"><mutation max=\"Infinity\" min=\"0\" precision=\"0\"></mutation><field name=\"NUM\">50</field></shadow></value></block></next></block></next></block></statement></block>","screen":[{"simulationName":"Built-in","type":"builtin","width":320,"height":240,"scale":0.78,"screenName":"","blockId":"","screenColorType":0,"id":"builtin","createTime":1720057143757}],"logicWhenNum":0,"customList":[]}

‎examples/unit/mqtt/mqtt_demo.py‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
6+
importos,sys,io
7+
importM5
8+
fromM5import*
9+
fromunitimportMQTTUnit
10+
importtime
11+
12+
13+
mqtt_0=None
14+
15+
16+
defmqtt_0_SubTopic_event(data):# noqa: N802
17+
globalmqtt_0
18+
print(data[0])
19+
print(data[1])
20+
21+
22+
defsetup():
23+
globalmqtt_0
24+
25+
M5.begin()
26+
Widgets.fillScreen(0x222222)
27+
28+
mqtt_0=MQTTUnit(port=(18,17))
29+
mqtt_0.set_client("m5-mqtt-xxx","mqtt.m5stack.com",1883,"","",120)
30+
mqtt_0.set_subscribe("SubTopic",mqtt_0_SubTopic_event,0)
31+
mqtt_0.set_connect()
32+
33+
34+
defloop():
35+
globalmqtt_0
36+
M5.update()
37+
mqtt_0.check_msg()
38+
time.sleep_ms(50)
39+
40+
41+
if__name__=="__main__":
42+
try:
43+
setup()
44+
whileTrue:
45+
loop()
46+
except (Exception,KeyboardInterrupt)ase:
47+
try:
48+
fromutilityimportprint_error_msg
49+
50+
print_error_msg(e)
51+
exceptImportError:
52+
print("please update to latest firmware")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"V2.0","versionNumber":"V2.0.8","type":"cores3","components":[{"name":"screen","type":"screen","layer":0,"screenId":"builtin","screenName":"","id":"__cores3_screen","createTime":1720057503088,"x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","size":0,"isSelected":true}],"resources":[{"hardware":["hardware_button","hardware_pin_button","imu","speaker","touch","als","mic"]},{"unit":["unit_mqttpoe"]}],"units":[{"type":"unit_mqttpoe","name":"mqttpoe_0","portList":["A","B","C","Custom"],"portType":"C","userPort":[22,21],"id":"dckd$9yJ0yVjL*Je","createTime":1720057554512,"initBlockId":"eB38WZ$xZ_*@vr*Vh%Qi"}],"hats":[],"bases":[],"i2cs":[],"blockly":"<block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"-310\" y=\"-290\"><mutation isBegin=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_begin\" id=\"system_m5_begin\"><next><block type=\"unit_mqttpoe_init\" id=\"eB38WZ$xZ_*@vr*Vh%Qi\"><field name=\"NAME\">mqttpoe_0</field><next><block type=\"unit_mqttpoe_set_server_config\" id=\"j=}Wt++xB`%xJxoy}rj-\"><field name=\"NAME\">mqttpoe_0</field><value name=\"ID\"><shadow type=\"text\" id=\"R_.*;64J3Nv$MV7d6dKO\"><field name=\"TEXT\">m5-mqtt-xxx</field></shadow></value><value name=\"SERVER\"><shadow type=\"text\" id=\"vB:z@fvpF1U%061HUWf+\"><field name=\"TEXT\">mqtt.m5stack.com</field></shadow></value><value name=\"PORT\"><shadow type=\"math_number\" id=\"xd;:X(yx3{OaFgUd]szn\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">1883</field></shadow></value><value name=\"USERNAME\"><shadow type=\"text\" id=\"pU7#$,)uN*Oq[/4*?L?7\"><field name=\"TEXT\"></field></shadow></value><value name=\"PASSWORD\"><shadow type=\"text_password\" id=\"n[W.v]})A?u96PL1^d+r\"><mutation show=\"true\"></mutation><field name=\"TEXT\"></field></shadow></value><value name=\"KEEPALIVE\"><shadow type=\"math_slider\" id=\"nr6(s@D,40*l/jx-~U+S\"><mutation max=\"65535\" min=\"0\" step=\"1\" precision=\"1\"></mutation><field name=\"NUM\">120</field></shadow></value><next><block type=\"unit_mqttpoe_set_connect\" id=\"-DV1u9ik-fA-JhPt,4L9\"><field name=\"NAME\">mqttpoe_0</field></block></next></block></next></block></next></block></statement></block><block type=\"unit_mqttpoe_subscribe_callback\" id=\"V!lQD^RR]n^v;V*%Vk*j\" x=\"-310\" y=\"110\"><field name=\"NAME\">mqttpoe_0</field><value name=\"MSG\"><shadow type=\"text\" id=\"Vni)t$67U*t@xDI?).U2\"><field name=\"TEXT\">SubTopic</field></shadow></value><value name=\"QOS\"><shadow type=\"math_slider\" id=\"2S$##E@;7on5=7R~=s_o\"><mutation max=\"2\" min=\"0\" step=\"1\" precision=\"1\"></mutation><field name=\"NUM\">0</field></shadow></value><statement name=\"FUNC\"><block type=\"text_print\" id=\"7dHHw_(wv!;,3iFu4drt\"><value name=\"TEXT\"><shadow type=\"text\" id=\"`yvG%sCX/*-}h:Tp(.s;\"><field name=\"TEXT\">hello M5</field></shadow><block type=\"unit_mqttpoe_get_topic\" id=\"+aN~HL4xt9-*50FZ0:DW\"></block></value><next><block type=\"text_print\" id=\"0N=mNRl(-._^;*#=3^qo\"><value name=\"TEXT\"><shadow type=\"text\" id=\"MGBWxY_4fsmJVr!6e|Wm\"><field name=\"TEXT\">hello M5</field></shadow><block type=\"unit_mqttpoe_get_msg\" id=\"LPThKiW%Sp.5zapy`b,H\"></block></value></block></next></block></statement></block><block type=\"basic_on_loop\" id=\"loop_block\" deletable=\"false\" x=\"-310\" y=\"290\"><mutation isUpdate=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_update\" id=\"system_m5_update\"><next><block type=\"unit_mqttpoe_check_msg\" id=\"3wpDkh?V-p1`EE4fmniw\"><field name=\"NAME\">mqttpoe_0</field><next><block type=\"time_sleep_millisecond\" id=\"Q@6:UWI=$1R$taSKgRx~\"><value name=\"MS\"><shadow type=\"math_number\" id=\"{,hz^=Qe{nCM;O^X%eIe\"><mutation max=\"Infinity\" min=\"0\" precision=\"0\"></mutation><field name=\"NUM\">50</field></shadow></value></block></next></block></next></block></statement></block>","screen":[{"simulationName":"Built-in","type":"builtin","width":320,"height":240,"scale":0.78,"screenName":"","blockId":"","screenColorType":0,"id":"builtin","createTime":1720057503081}],"logicWhenNum":0,"customList":[]}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
6+
importos,sys,io
7+
importM5
8+
fromM5import*
9+
fromunitimportMQTTPoEUnit
10+
importtime
11+
12+
13+
mqttpoe_0=None
14+
15+
16+
defmqttpoe_0_SubTopic_event(data):# noqa: N802
17+
globalmqttpoe_0
18+
print(data[0])
19+
print(data[1])
20+
21+
22+
defsetup():
23+
globalmqttpoe_0
24+
25+
M5.begin()
26+
Widgets.fillScreen(0x222222)
27+
28+
mqttpoe_0=MQTTPoEUnit(port=(18,17))
29+
mqttpoe_0.set_client("m5-mqtt-xxx","mqtt.m5stack.com",1883,"","",120)
30+
mqttpoe_0.set_subscribe("SubTopic",mqttpoe_0_SubTopic_event,0)
31+
mqttpoe_0.set_connect()
32+
33+
34+
defloop():
35+
globalmqttpoe_0
36+
M5.update()
37+
mqttpoe_0.check_msg()
38+
time.sleep_ms(50)
39+
40+
41+
if__name__=="__main__":
42+
try:
43+
setup()
44+
whileTrue:
45+
loop()
46+
except (Exception,KeyboardInterrupt)ase:
47+
try:
48+
fromutilityimportprint_error_msg
49+
50+
print_error_msg(e)
51+
exceptImportError:
52+
print("please update to latest firmware")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp