zh07 - ZH07 Laser Dust Sensor#
Adaptation status unknown
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Example
--Note: due to the use of sys.wait() all apis need to be used in the coroutine
-- Usage Examples
sys = require("sys")
local zh07 = require "zh07"
local uartid = 1 -- According to the actual equipment to select different uartid
sys.taskInit(function ()
local result = zh07.init(uartid)
if not result then return end
while true do
sys.wait(1000)
log.info(string.format("pm1.0 %sμg/m³", zh07.getPM_1()))
log.info(string.format("pm2.5 %sμg/m³", zh07.getPM_2_5()))
log.info(string.format("pm10 %sμg/m³", zh07.getPM_10()))
end
end)
zh07.init(uart_id)#
zh07 Initialization
Parameters
Incoming Value Type |
Explanation |
---|---|
number |
uart_id uartid |
Return Value
return value type |
explanation |
---|---|
bool |
Successful return true |
Examples
zh07.init(1)
zh07.getPM_1()#
Obtaining zh07 PM1.0 Data
Parameters
None
Return Value
return value type |
explanation |
---|---|
number |
PM1.0 Data |
Examples
local zh07_pm1 = zh07.getPM_1()
log.info(string.format("pm1.0 %sμg/m³", zh07_pm1))
zh07.getPM_2_5()#
Obtain zh07 PM2.5 data
Parameters
None
Return Value
return value type |
explanation |
---|---|
number |
PM2.5 Data |
Examples
local zh07_pm25 = zh07.getPM_2_5()
log.info(string.format("pm2.5 %sμg/m³", zh07_pm25))
zh07.getPM_10()#
Obtaining zh07 PM10 Data
Parameters
None
Return Value
return value type |
explanation |
---|---|
number |
PM10 Data |
Examples
local zh07_pm10 = zh07.getPM_10()
log.info(string.format("pm10 %sμg/m³", zh07_pm10))