nodemcu-firmware/lua_modules/tsl2561/tsl2561_EN.md

1.0 KiB

tsl2561 Module

##Require

tsl2561 = require("tsl2561")

Release

tsl2561 = nil
package.loaded["tsl2561"]=nil

##init() ####Description Setting the I2C pin of tsl2561.

####Syntax init(sda, scl)

####Parameters sda: 1~12, IO index.
scl: 1~12, IO index.

####Returns nil

####Example

SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14

tsl2561 = require("tsl2561")
tsl2561.init(SDA_PIN, SCL_PIN)

-- release module
tsl2561 = nil
package.loaded["tsl2561"]=nil

####See also -

##readVisibleLux() ####Description Get the Lux reading of visible light

####Syntax readVisibleLux()

####Parameters nil.

####Returns nil.

####Example

SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14

tsl2561 = require("tsl2561")
tsl2561.init(SDA_PIN, SCL_PIN)
lux = tsl2561.readVisibleLux()

-- release module
tsl2561 = nil
package.loaded["tsl2561"]=nil

####See also -