nvbn / microasync

Green threads and CSP for micropython
5 stars 1 forks source link

microasync

Green threads and CSP for micropython.

Api documentation <http://microasync.readthedocs.org/>_.

Installation

For installing run:

.. code-block:: bash

MICROPYPATH='path-to-pyboard' pip-micropython install microasync

Basic usage

For basic usage you should create coroutines and start main loop. For example, script that prints ok! every ten seconds:

.. code-block:: python

from microasync.async import loop, coroutine, Delay

@coroutine
def main_coroutine():
    while True:
        print('ok!')
        yield Delay(10)

main_coroutine()
loop()

More examples: