vl6180 - VL6180 laser ranging 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


--MCU                        vl6180
--3V3                        VIN
--GND                        GND
--I2CSCL                     SCL
--I2CSDA                     SDA
--GPIO                       GPIO1(SHDN/interrupt output)
--GPIO                       GPIO0(CE)

vl6180 Measurement Description:
1、Only a single measurement, measuring the absolute distance of 0-10cm
2、The effective measurement range is 20-30cm

--Note: due to the use of sys.wait() all apis need to be used in the coroutine
-- Usage Examples
vl6180=require"vl6180"
local CE=4
local INT=21
local I2C_ID=0
sys.taskInit(function()
    sys.wait(2000)
    log.info('Initialization')
    vl6180.init(CE,INT,I2C_ID)
    while true do
        sys.wait(200)
        --Single measurement start
        log.info('Distance:',vl6180.get())
    end
end)

vl6180.init(ce,int,id)#

vl6180 Initialization

Parameters

Incoming Value Type

Explanation

number

ce gpio Number [Control]

number

int gpio Number [Interrupted]

number

id i2c Bus id

Return Value

return value type

explanation

bool

Return true on success Return true on failure false

Examples

vl6180.Init(4,21,0)

vl6180.get()#

vl6180 Gets measured distance value units:mm

Parameters

None

Return Value

return value type

explanation

number

Return vl6180 data on success, return on failure 0

Examples

local data=vl6180.get()
log.info("measuring val:",data)