Skip to content

Commit bd29e3c

Browse files
Tinyu-Zhaolbuque
authored andcommitted
lib/unit: Add Unit MQ support.
Signed-off-by: [email protected] <[email protected]>
1 parent cd4bdc3 commit bd29e3c

File tree

9 files changed

+929
-1
lines changed

9 files changed

+929
-1
lines changed

docs/en/refs/unit.mq.ref

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
.. |MQ| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/co2/co2_01.webp
3+
:target: https://docs.m5stack.com/en/unit/co2
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/init.png
8+
9+
.. |set_mq_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/set_mq_mode.png
10+
.. |get_mq_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_mq_mode.png
11+
.. |set_led_status.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/set_led_status.png
12+
.. |get_led_status.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_led_status.png
13+
.. |set_heat_time.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/set_heat_time.png
14+
.. |get_heat_time.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_heat_time.png
15+
.. |get_adc_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_adc_value.png
16+
.. |get_valid_tags.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_valid_tags.png
17+
.. |get_ntc_adc_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_ntc_adc_value.png
18+
.. |get_ntc_res_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_ntc_res_value.png
19+
.. |get_voltage.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_voltage.png
20+
.. |get_firmware_version.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_firmware_version.png
21+
.. |get_i2c_address.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/get_i2c_address.png
22+
.. |set_i2c_address.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/set_i2c_address.png
23+
24+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/mq/example.png
25+
26+
.. |mq_core2_example.m5f2| raw:: html
27+
28+
<a
29+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/mq/mq_core2_example.m5f2"
30+
target="_blank"
31+
>
32+
mq_core2_example.m5f2
33+
</a>

docs/en/units/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ Unit
7474
midi.rst
7575
minioled.rst
7676
miniscale.rst
77-
tof90.rst
77+
mq.rst
7878
mqtt.rst
7979
mqttpoe.rst
80+
tof90.rst
8081
nbiot.rst
8182
nbiot2.rst
8283
ncir.rst

docs/en/units/mq.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
MQ Unit
2+
==========
3+
4+
.. sku: U199
5+
6+
.. include:: ../refs/unit.mq.ref
7+
8+
This is the driver library of MQ Unit, which is used to obtain data from the
9+
MQ sensor.
10+
11+
Support the following products:
12+
13+
|MQ|
14+
15+
16+
UiFlow2 Example
17+
---------------
18+
19+
get MQ value
20+
^^^^^^^^^^^^^^^
21+
22+
Open the |mq_core2_example.m5f2| project in UiFlow2.
23+
24+
This example gets the MQ value of the MQ Unit and displays it on the screen.
25+
26+
UiFlow2 Code Block:
27+
28+
|example.png|
29+
30+
Example output:
31+
32+
None
33+
34+
MicroPython Example
35+
-------------------
36+
37+
get MQ value
38+
^^^^^^^^^^^^^^^
39+
40+
This example gets the MQ value of the MQ Unit and displays it on the screen.
41+
42+
MicroPython Code Block:
43+
44+
.. literalinclude:: ../../../examples/unit/mq/mq_core2_example.py
45+
:language: python
46+
:linenos:
47+
48+
Example output:
49+
50+
None
51+
52+
53+
**API**
54+
-------
55+
56+
MQUnit
57+
^^^^^^^^^
58+
59+
.. autoclass:: unit.mq.MQUnit
60+
:members:

0 commit comments

Comments
 (0)