ec11 - ec11 Rotary encoder#

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

-- Usage instance, currently supports a certain pulse.
local ec11 = require("ec11")

-- Write as per actual wiring
local GPIO_A = 6
local GPIO_B = 7
ec11.init(GPIO_A,GPIO_B)

-- Demo Reception Rotation Effect
local count = 0
local function ec11_callBack(direction)
    if direction == "left" then
        -- Select left, counterclockwise
        count = count - 1
    else
        -- Turn right, clockwise
        count = count + 1
    end
    log.info("ec11", direction, count)
end

sys.subscribe("ec11",ec11_callBack)

ec11.init(GPIO_A,GPIO_B)#

Initialization ec11

Parameters

Incoming Value Type

Explanation

number

GPIO_A A The GPIO number corresponding to the pin, such as GPIO6, is written 6

number

GPIO_B B The GPIO number corresponding to the pin, such as GPIO7, is written 7

Return Value

None

Examples

ec11.init(6,7)