pcf8574 - pcf8574 IO Extension#

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
local pcf8574 = require "pcf8574"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
    i2c.setup(i2cid,i2c_speed)
    pcf8574.init(i2cid)--initialization, passing in i2c_id
    for i=0,7 do
        print(pcf8574.pin(i))
    end
    pcf8574.pin(0,1)
    for i=0,7 do
        print(pcf8574.pin(i))
    end
end)

pcf8574.init(i2c_id)#

pcf8574 Initialization

Parameters

Incoming Value Type

Explanation

number

The i2c bus id

Return Value

return value type

explanation

bool

Successful return true

Examples

pcf8574.init(0)

pcf8574.pin(pin,val)#

pcf8574 pin Control

Parameters

Incoming Value Type

Explanation

number

pin 0-7

number

val 0/1 Optional, read level if not filled

Return Value

return value type

explanation

number

If val is not filled, return read level

Examples

pcf8574.pin(0,1)
print(pcf8574.pin(0))