Skip to content

Commit f4d8d0b

Browse files
committed
docs: Add Lora Module example.
Signed-off-by: lbuque <[email protected]>
1 parent 2f7606e commit f4d8d0b

10 files changed

+312
-23
lines changed

docs/en/module/lora.rst

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,35 @@ Micropython Example::
2020
lora = LoraModule(pin_irq=35, pin_rst=25) # core2
2121
lora = LoraModule(pin_irq=10, pin_rst=5) # cores3
2222
lora.send("Hello, LoRa!")
23-
23+
2424
print(lora.recv())
25-
25+
2626
def callback(received_data):
2727
global lora
2828
print(received_data)
2929
lora.start_recv()
3030
lora.set_irq_callback(callback)
3131
lora.start_recv()
3232

33+
3334
UIFLOW2 Example:
3435

3536
|example_tx.svg|
37+
3638
|example_rx.svg|
3739

40+
3841
.. only:: builder_html
3942

43+
|cores3_lora433_rx_example.m5f2|
44+
45+
|cores3_lora433_tx_example.m5f2|
46+
47+
|cores3_lora868_rx_example.m5f2|
48+
49+
|cores3_lora868_tx_example.m5f2|
50+
51+
4052
class LoraModule
4153
----------------
4254

@@ -59,7 +71,7 @@ Constructors
5971

6072
UIFLOW2:
6173

62-
|init.svg|
74+
|init.png|
6375

6476

6577
Methods
@@ -76,7 +88,7 @@ Methods
7688

7789
UIFLOW2:
7890

79-
|send.svg|
91+
|send.png|
8092

8193
.. method:: LoraModule.recv(timeout_ms, rx_length, rx_packet)
8294

@@ -90,7 +102,7 @@ Methods
90102

91103
UIFLOW2:
92104

93-
|recv.svg|
105+
|recv.png|
94106

95107
.. method:: LoraModule.start_recv()
96108

@@ -100,7 +112,7 @@ Methods
100112

101113
UIFLOW2:
102114

103-
|start_recv.svg|
115+
|start_recv.png|
104116

105117
.. method:: LoraModule.set_irq_callback(callback)
106118

@@ -111,7 +123,7 @@ Methods
111123

112124
UIFLOW2:
113125

114-
|set_irq_callback.svg|
126+
|set_irq_callback.png|
115127

116128
.. method:: LoraModule.standby()
117129

@@ -121,7 +133,7 @@ Methods
121133

122134
UIFLOW2:
123135

124-
|standby.svg|
136+
|standby.png|
125137

126138
.. method:: LoraModule.sleep()
127139

@@ -131,7 +143,7 @@ Methods
131143

132144
UIFLOW2:
133145

134-
|sleep.svg|
146+
|sleep.png|
135147

136148
.. method:: LoraModule.irq_triggered()
137149

@@ -141,7 +153,7 @@ Methods
141153

142154
UIFLOW2:
143155

144-
|irq_triggered.svg|
156+
|irq_triggered.png|
145157

146158

147159

@@ -153,9 +165,9 @@ Constants
153165

154166
Select the LoRa frequency band.
155167

156-
168+
157169
.. data:: LoraModule.BANDWIDTHS
158170

159171
Valid bandwidth
160172

161-
173+

docs/en/refs/module.lora.ref

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,50 @@
44
:height: 200px
55
:width: 200px
66

7-
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/init.svg
8-
.. |send.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/send.svg
9-
.. |recv.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/recv.svg
10-
.. |start_recv.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/start_recv.svg
11-
.. |set_irq_callback.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/set_irq_callback.svg
12-
.. |standby.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/standby.svg
13-
.. |sleep.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/sleep.svg
14-
.. |irq_triggered.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/irq_triggered.svg
15-
16-
.. |example_tx.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/example_tx.svg
17-
.. |example_rx.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora/example._rxsvg
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/init.png
8+
.. |send.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/send.png
9+
.. |recv.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/recv.png
10+
.. |start_recv.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/start_recv.png
11+
.. |set_irq_callback.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/set_irq_callback.png
12+
.. |standby.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/standby.png
13+
.. |sleep.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/sleep.png
14+
.. |irq_triggered.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/irq_triggered.png
1815

16+
.. |example_tx.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/example_tx.svg
17+
.. |example_rx.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/lora433/example_rx.svg
18+
19+
.. |cores3_lora433_rx_example.m5f2| raw:: html
20+
21+
<a
22+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lora433/cores3_lora433_rx_example.m5f2"
23+
target="_blank"
24+
>
25+
cores3_lora433_rx_example.m5f2
26+
</a>
27+
28+
.. |cores3_lora433_tx_example.m5f2| raw:: html
29+
30+
<a
31+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lora433/cores3_lora433_tx_example.m5f2"
32+
target="_blank"
33+
>
34+
cores3_lora433_tx_example.m5f2
35+
</a>
36+
37+
.. |cores3_lora868_rx_example.m5f2| raw:: html
38+
39+
<a
40+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lora433/cores3_lora868_rx_example.m5f2"
41+
target="_blank"
42+
>
43+
cores3_lora868_rx_example.m5f2
44+
</a>
45+
46+
.. |cores3_lora868_tx_example.m5f2| raw:: html
47+
48+
<a
49+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lora433/cores3_lora868_tx_example.m5f2"
50+
target="_blank"
51+
>
52+
cores3_lora868_tx_example.m5f2
53+
</a>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"V2.0","versionNumber":"V2.1.3","type":"cores3","components":[{"name":"screen","type":"screen","layer":0,"screenId":"builtin","screenName":"","id":"__cores3_screen","createTime":1725000666918,"x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","size":0,"isSelected":true},{"name":"label0","type":"label","layer":1,"screenId":"builtin","screenName":"","id":"u*62M+3W3xVV9ibz","createTime":1725001159190,"x":8,"y":31,"color":"#ffffff","backgroundColor":"#222222","text":"Received:","engine":"gfx","font":"Widgets.FONTS.DejaVu18","rotation":0,"isSelected":false,"width":87,"height":20},{"name":"recvdata","type":"label","layer":2,"screenId":"builtin","screenName":"","id":"r5%Lk*qi_dM=iNO6","createTime":1725001169202,"x":13,"y":73,"color":"#ffffff","backgroundColor":"#222222","text":"label1","engine":"gfx","font":"Widgets.FONTS.DejaVu24","rotation":0,"isSelected":false,"width":74,"height":27},{"name":"label1","type":"label","layer":3,"screenId":"builtin","screenName":"","id":"vF`3&vZrq$zQ@h`W","createTime":1725001159190,"x":9,"y":137,"color":"#ffffff","backgroundColor":"#222222","text":"Timestamp:","engine":"gfx","font":"Widgets.FONTS.DejaVu18","rotation":0,"isSelected":false,"width":106,"height":20},{"name":"timestamp","type":"label","layer":4,"screenId":"builtin","screenName":"","id":"m+oKfFlp8zEo9Fjv","createTime":1725001169202,"x":15,"y":178,"color":"#ffffff","backgroundColor":"#222222","text":"label2","engine":"gfx","font":"Widgets.FONTS.DejaVu24","rotation":0,"isSelected":false,"width":74,"height":27},{"name":"title0","type":"title","layer":5,"screenId":"builtin","screenName":"","id":"fJxIeunNcLK%2cKo","createTime":1725001886455,"x":0,"y":0,"color":"#ffffff","backgroundColor":"#0000FF","text":"LoRa Module Example","textOffset":3,"font":"Widgets.FONTS.DejaVu18","isSelected":false,"width":321,"height":19}],"resources":[{"hardware":["hardware_button","hardware_pin_button","imu","speaker","touch","als","mic"]},{"module":["module_lora433"]}],"units":[],"hats":[],"bases":[],"i2cs":[],"blockly":"<variables><variable id=\"U!@bW9wU*}ayWv^c)rWb\">lora433_data</variable></variables><block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"50\" y=\"50\"><mutation isBegin=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_begin\" id=\"system_m5_begin\"><next><block type=\"module_lora433_init\" id=\"eG=D+n@18gHiABZ$hKJ[\"><mutation isCustom=\"False\"></mutation><field name=\"NAME\">lora433_0</field><field name=\"OPTION\">False</field><value name=\"CS\"><shadow type=\"math_number\" id=\"*CRLjmDLe~ExcC!vYizp\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><value name=\"IRQ\"><shadow type=\"math_number\" id=\"4`Hu_;^z/K(,U,QS?%bR\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">10</field></shadow></value><value name=\"RST\"><shadow type=\"math_number\" id=\"^g[,?s$!pwx2Mpr0;gyO\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">5</field></shadow></value><next><block type=\"module_lora433_start_recv\" id=\"#/$f@INb59*`$Q5mR7,3\"><field name=\"NAME\">lora433_0</field></block></next></block></next></block></statement></block><block type=\"basic_on_loop\" id=\"loop_block\" deletable=\"false\" x=\"450\" y=\"50\"><mutation isUpdate=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_update\" id=\"system_m5_update\"></block></statement></block><block type=\"module_lora433_receive_data_event\" id=\"6dcN%2@ylQzJ`IG+}Z*o\" x=\"450\" y=\"190\"><field name=\"NAME\">lora433_0</field><value name=\"DATA\"><block type=\"variables_get\" id=\"3jA42MdUw%1=:{!$U$]@\"><field name=\"VAR\" id=\"U!@bW9wU*}ayWv^c)rWb\">lora433_data</field></block></value><statement name=\"FUNC\"><block type=\"label_set_text\" id=\"6]cIU+uZ[Qs0Q/mrz@UY\"><field name=\"NAME\">recvdata</field><value name=\"TEXT\"><shadow type=\"text\" id=\"q2Eed8SR5]OQO!$(.GtK\"><field name=\"TEXT\">Label</field></shadow><block type=\"text_decode_str\" id=\"(c{[-,!I~x@i|nL8%!Nu\"><value name=\"VALUE\"><block type=\"variables_get\" id=\"]yB$ULVtIl=aO=i84IYa\"><field name=\"VAR\" id=\"U!@bW9wU*}ayWv^c)rWb\">lora433_data</field></block></value></block></value><next><block type=\"label_set_text\" id=\"h@|,Xd!a/3JhbxHh0MR`\"><field name=\"NAME\">timestamp</field><value name=\"TEXT\"><shadow type=\"text\" id=\"q2Eed8SR5]OQO!$(.GtK\"><field name=\"TEXT\">Label</field></shadow><block type=\"time_get_ticks_ms\" id=\"Ab@/w[l8dpw9[k=(/4_,\"></block></value></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":1725000666915}],"logicWhenNum":0,"customList":[]}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import os, sys, io
6+
import M5
7+
from M5 import *
8+
from module import LoraModule
9+
import time
10+
11+
12+
label0 = None
13+
recvdata = None
14+
label1 = None
15+
timestamp = None
16+
title0 = None
17+
lora433_0 = None
18+
19+
20+
lora433_data = None
21+
22+
23+
def lora433_0_receive_event(received_data):
24+
global label0, recvdata, label1, timestamp, title0, lora433_0, lora433_data
25+
lora433_data = received_data
26+
recvdata.setText(str(lora433_data.decode()))
27+
timestamp.setText(str(time.ticks_ms()))
28+
29+
30+
def setup():
31+
global label0, recvdata, label1, timestamp, title0, lora433_0, lora433_data
32+
33+
M5.begin()
34+
Widgets.fillScreen(0x222222)
35+
label0 = Widgets.Label("Received:", 8, 31, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
36+
recvdata = Widgets.Label("label1", 13, 73, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu24)
37+
label1 = Widgets.Label("Timestamp:", 9, 137, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
38+
timestamp = Widgets.Label("label2", 15, 178, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu24)
39+
title0 = Widgets.Title("LoRa Module Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18)
40+
41+
lora433_0 = LoraModule(0, 10, 5, null, 8, 250, 8, 12, 200)
42+
lora433_0.set_irq_callback(lora433_0_receive_event)
43+
lora433_0.start_recv()
44+
45+
46+
def loop():
47+
global label0, recvdata, label1, timestamp, title0, lora433_0, lora433_data
48+
M5.update()
49+
50+
51+
if __name__ == "__main__":
52+
try:
53+
setup()
54+
while True:
55+
loop()
56+
except (Exception, KeyboardInterrupt) as e:
57+
try:
58+
from utility import print_error_msg
59+
60+
print_error_msg(e)
61+
except ImportError:
62+
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.1.3","type":"cores3","components":[{"name":"screen","type":"screen","layer":0,"screenId":"builtin","screenName":"","id":"__cores3_screen","createTime":1725001688076,"x":0,"y":0,"width":320,"height":240,"backgroundColor":"#222222","size":0,"isSelected":true},{"name":"label9","type":"label","layer":1,"screenId":"builtin","screenName":"","id":"k4ZeVjFI-Ml8XSpu","createTime":1725001697350,"x":10,"y":32,"color":"#ffffff","backgroundColor":"#222222","text":"Data sent:","engine":"gfx","font":"Widgets.FONTS.DejaVu18","rotation":0,"isSelected":false,"width":93,"height":20},{"name":"title0","type":"title","layer":2,"screenId":"builtin","screenName":"","id":"a0QLL`Nsa@PrlU37","createTime":1725001699390,"x":0,"y":0,"color":"#ffffff","backgroundColor":"#0000FF","text":"LoRa Module Example","textOffset":3,"font":"Widgets.FONTS.DejaVu18","isSelected":false,"width":321,"height":19},{"name":"datasent","type":"label","layer":3,"screenId":"builtin","screenName":"","id":"cD-nu9w*E1yCedi^","createTime":1725001741615,"x":11,"y":73,"color":"#ffffff","backgroundColor":"#222222","text":"label0","engine":"gfx","font":"Widgets.FONTS.DejaVu24","rotation":0,"isSelected":false,"width":74,"height":27},{"name":"label0","type":"label","layer":4,"screenId":"builtin","screenName":"","id":"k6nxhgAS5_Enz15V","createTime":1725001697350,"x":10,"y":127,"color":"#ffffff","backgroundColor":"#222222","text":"Timestamp:","engine":"gfx","font":"Widgets.FONTS.DejaVu18","rotation":0,"isSelected":false,"width":106,"height":20},{"name":"timestamp","type":"label","layer":5,"screenId":"builtin","screenName":"","id":"r90V*l5z^5ho^Q^x","createTime":1725001741615,"x":14,"y":176,"color":"#ffffff","backgroundColor":"#222222","text":"label1","engine":"gfx","font":"Widgets.FONTS.DejaVu24","rotation":0,"isSelected":false,"width":74,"height":27}],"resources":[{"hardware":["hardware_button","hardware_pin_button","imu","speaker","touch","als","mic"]},{"module":["module_lora433"]}],"units":[],"hats":[],"bases":[],"i2cs":[],"blockly":"<variables><variable id=\"N~]qL+ChBKq^8(%YSjk%\">x</variable></variables><block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"50\" y=\"50\"><mutation isBegin=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_begin\" id=\"system_m5_begin\"><next><block type=\"module_lora433_init\" id=\".fUjehFM6n%xPS%#jce:\"><mutation isCustom=\"False\"></mutation><field name=\"NAME\">lora433_0</field><field name=\"OPTION\">False</field><value name=\"CS\"><shadow type=\"math_number\" id=\"7Si,%:D4JzFXJwvqcXsS\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><value name=\"IRQ\"><shadow type=\"math_number\" id=\"_Ybrh2oCsGVqZB(#fH5f\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">10</field></shadow></value><value name=\"RST\"><shadow type=\"math_number\" id=\"xZ]uE#m}{K7+b+.DCvXz\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">5</field></shadow></value></block></next></block></statement></block><block type=\"basic_on_loop\" id=\"loop_block\" deletable=\"false\" x=\"450\" y=\"50\"><mutation isUpdate=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_update\" id=\"system_m5_update\"><next><block type=\"math_change\" id=\"Ii1J]t-6fj8$})Cwt(a7\"><field name=\"VAR\" id=\"N~]qL+ChBKq^8(%YSjk%\">x</field><value name=\"DELTA\"><shadow type=\"math_number\" id=\"Z)C_~8Na$,V/I`@}nP4U\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">1</field></shadow></value><next><block type=\"label_set_text\" id=\"{#0[}ge$FkAh4{PpAiO8\"><field name=\"NAME\">timestamp</field><value name=\"TEXT\"><shadow type=\"text\" id=\"NTeVZP*M:_qtg-bA/@?8\"><field name=\"TEXT\">Label</field></shadow><block type=\"module_lora433_send\" id=\"TvGj+Bni:;[iz-z=w]}@\"><field name=\"NAME\">lora433_0</field><value name=\"DATA\"><block type=\"text_add_str\" id=\"]N/27hh@5gU?8i;El7~J\"><value name=\"VALUE1\"><shadow type=\"text\" id=\"aSzM4B%1oR-P4edrTyNF\"><field name=\"TEXT\">Hello M5! </field></shadow></value><value name=\"VALUE2\"><block type=\"variables_get\" id=\"]T%$6$i@(e.e=Apz~t`X\"><field name=\"VAR\" id=\"N~]qL+ChBKq^8(%YSjk%\">x</field></block></value></block></value></block></value><next><block type=\"label_set_text\" id=\"O[Z.x@g%OGVOeACoT+^T\"><field name=\"NAME\">datasent</field><value name=\"TEXT\"><shadow type=\"text\" id=\"NTeVZP*M:_qtg-bA/@?8\"><field name=\"TEXT\">Label</field></shadow><block type=\"text_add_str\" id=\"15Sy_Zt=cH;}f$awg5SF\"><value name=\"VALUE1\"><shadow type=\"text\" id=\"Wjk`ykY4rMP~-/H@DDZ+\"><field name=\"TEXT\">Hello M5! </field></shadow></value><value name=\"VALUE2\"><block type=\"variables_get\" id=\"w7,4+W(@t?fgDxJR~4Gs\"><field name=\"VAR\" id=\"N~]qL+ChBKq^8(%YSjk%\">x</field></block></value></block></value><next><block type=\"time_sleep_second\" id=\"8|ZQ.N[=k62qY()nN=Ic\"><value name=\"SECOND\"><shadow type=\"math_number\" id=\"rRp^==Wtz`FHeN0a_jQy\"><mutation max=\"Infinity\" min=\"0\" precision=\"0\"></mutation><field name=\"NUM\">1</field></shadow></value></block></next></block></next></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":1725001688076}],"logicWhenNum":0,"customList":[]}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import os, sys, io
6+
import M5
7+
from M5 import *
8+
from module import LoraModule
9+
import time
10+
11+
12+
label9 = None
13+
title0 = None
14+
datasent = None
15+
label0 = None
16+
timestamp = None
17+
lora433_0 = None
18+
19+
20+
x = None
21+
22+
23+
def setup():
24+
global label9, title0, datasent, label0, timestamp, lora433_0, x
25+
26+
M5.begin()
27+
Widgets.fillScreen(0x222222)
28+
label9 = Widgets.Label("Data sent:", 10, 32, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
29+
title0 = Widgets.Title("LoRa Module Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18)
30+
datasent = Widgets.Label("label0", 11, 73, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu24)
31+
label0 = Widgets.Label("Timestamp:", 10, 127, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
32+
timestamp = Widgets.Label("label1", 14, 176, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu24)
33+
34+
lora433_0 = LoraModule(0, 10, 5, null, 8, 250, 8, 12, 200)
35+
36+
37+
def loop():
38+
global label9, title0, datasent, label0, timestamp, lora433_0, x
39+
M5.update()
40+
x = (x if isinstance(x, (int, float)) else 0) + 1
41+
timestamp.setText(str("Label"))
42+
datasent.setText(str((str("Hello M5! ") + str(x))))
43+
time.sleep(1)
44+
45+
46+
if __name__ == "__main__":
47+
try:
48+
setup()
49+
while True:
50+
loop()
51+
except (Exception, KeyboardInterrupt) as e:
52+
try:
53+
from utility import print_error_msg
54+
55+
print_error_msg(e)
56+
except ImportError:
57+
print("please update to latest firmware")

0 commit comments

Comments
 (0)