statem - SM State Machine#
Adapted Air780E Air780EP Air780EPS
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view the demo example of statem
statem.create(count, repeat)#
Create a new state machine.
Parameters
Incoming Value Type |
Explanation |
---|---|
int |
Number of instructions, 32 by default |
int |
The number of repetitions. 0 means no repetition. A positive integer means the number of repetitions. Perpetual execution is not supported. |
Return Value
return value type |
explanation |
---|---|
some |
Returns the state machine pointer if successful, otherwise nil |
Examples
gpio.setup(7, 0, gpio.PULLUP)
gpio.setup(12, 0, gpio.PULLUP)
gpio.setup(13, 0, gpio.PULLUP)
gpio.setup(14, 0, gpio.PULLUP)
local sm = statem.create()
:gpio_set(7, 0) -- gpio Set to Low
:usleep(10) -- Dormancy 10us
:gpio_set(7, 1) -- gpio Set to High
:usleep(40) -- Dormancy 40us
:gpio_set(12, 1) -- gpio Set to High
:gpio_set(13, 1) -- gpio Set to High
:gpio_set(14, 1) -- gpio Set to High
:usleep(40) -- Dormancy 40us
:gpio_set(7, 0) -- gpio Set to Low
:finish()
-- Execute it, and the background execution will be supported later.
sm:exec()